Forum rules - please read before posting.

Problems when instantiating a hotspot prefab

So I need to dynamically instantiate certain objects in my scene, depending on whether the objects have been already picked up by the player or not. What I've done is to create a prefab with the object (which contains a hotspot). The objects are instantiated well so far.

The problem comes when I want to hook an action to the object's hotspot. I've created a parameterised action list asset for picking up objects in general, and that's what I want to set in the object prefab. I also create an additional prefab with the interaction so I can assign it to the hotspot (this prefab contains the parameterised actionlist asset). I can set it fine, but when I try to execute the action while playing, I get the following:

Coroutine 'EndCutscene' couldn't be started because the the game object 'Coffeelito_ Use' is inactive! UnityEngine.MonoBehaviour:StartCoroutine(String) AC.ActionList:CheckEndCutscene() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:563) ...


I certainly must be doing something wrong but am a bit lost at the moment... Any help?

Thanks!

Comments

  • Please include AC and Unity version numbers when posting issues - particularly when Console messages are included.

    The message itself is revealing - what is the state of "Cofeelito_Use" when it shows?  Is it indeed present (but inactive) in the Hierarchy?

    Are you relying on the fact that you can auto-set an ActionLists's first parameter as the Hotspot, so long as that parameter is a GameObject?  Also be aware that all ActionLists involved should be assets, since scene-based lists such as Interactions/Cutscenes can't keep their Actions in asset files.

    As this sounds like quite a specific issue, I need to be sure of exactly what's going on.  If you can share images and/or steps that clearly illustrate the problem and how to achieve it, I'll be able to attempt a recreation.
  • @ChrisIceBox Sorry - Unity version is 2017.4.2f2 and AC version is 1.62.2.

    Okay, what I'm trying to achieve is something quite typical: I want to place an object in the scene if and only if it hasn't been picked up by the player previously. This object does not necessarily need to be present in the scene since start/load.

    Since this particular object won't be there at the beginning, I've made it a prefab (I don't want to put it as a scene object). This prefab contains a hotspot so I can interact with it. So far, so good.

    Now to the prefab's interactions. Since picking up things is done quite often, I've created an ActionList asset named "Pickup", which is parameterised. I set the Interaction source to "Asset File" in the hotspot, and then link this new ActionList asset. But then, hey! My ActionList is parameterised and I can't pass the parameters from the Interaction in the prefab.

    So I tried creating a prefab out of the interaction itself, and then is when I got this error. After your answer, I now understand that the interaction would need to be part of the scene. So how can I do this? Hotspot prefab + Parameterised ActionList asset.

    I hope I explained myself well enough. Thanks!
  • If the parameterised ActionList asset includes a GameObject parameter, then you can configure the Hotspot to have it set itself as that parameter's value when the Interaction is run.

    Underneath the "Interaction" field in the Hotspot parameter, look for the "-> Hotspot parameter" field.  You can specify a GameObject parameter within the referenced ActionList asset, and that'll be then set to the Hotspot dynamically.

    Provided the Hotspot is on the root object, you can use the Object: Add or remove Action to remove that GameObject parameter, and in turn the Hotspot object.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.