Hi,
I've been working on a system that will spawn a random item in the scene that the player can pick up and have placed into their inventory. None of the items are placed in the scene before the game is run, just spawn points that indicate where items can appear.
My questions:
* Is there any built-in way to spawn an item into the scene with a unique interaction script that will point to that game object, hotspot, and inventory item?
* For the ActionListAsset, is it possible to set a hotspot as a parameter that can be passed in?
Currently I am attempting to instantiate the Interaction script and set the parameters for itemID for the inventory item as well as the game object that holds the sprite renderer for that object in the scene and the hotspot that should be disabled.
I currently attempt to create an instance of a prefab that has the sprite renderer and a constantID script on it along with another script that contains the inventory item ID. Nested within this is the hotspot script with no use interaction associated with it yet.
There is an interaction script in my scene that calls Engine: Run ActionList and points an an ActionListAsset file that contains the following actions:
* Add or Remove Object
* Hotspot Change Interaction (to disable Use)
* Inventory Add or Remove
I create a clone of the interaction script in my scene, and then set the parameters of the ActionListAsset to point to the instantiated game object with the sprite renderer etc. so that when it runs it will remove the object from the scene. I also read the itemID and set the intValue member for the second parameter which is used for the Inventory Add or Remove action.
When I run this however, it doesn't appear to save the references I set for each of the spawned objects in the scene and instead shows None for game object, and None for inventory item, although I can clearly see them set with breakpoints after each in my script where I set them.
Here's a link to the code snippet I'm using to do this.
Comments
interaction script that will point to that game object, hotspot, and
inventory item?
ActionList and points an an ActionListAsset file that contains the
following actions:
1) Bypass the Engine: Run ActionList Action completely - just call runtimeActionList = AdvGame.RunActionListAsset (_assetFile, 0); to run it manually after assigning the parameters.
2) Manipulate the Engine: Run ActionList's "assining" parameters instead - not those of the asset file.