Forum rules - please read before posting.

Dropped Object Parameter switching during runtime

I have a system where I pick up a torch and place it in a torch holder. Picking up the torch works fine and parents the gameobject to the characters left hand.

I then interact with the torch holder, and the gameobject parents itself to the marker on the torch holder.

Im storing the dropped item (Torch) in a assetlist parameter called Dropped Object. When I select the torch holder again, I expecting the Parameter (Dropped Object) to still contain the Torch GameObject (Which is does show in the inspector), but when I use the Character Hold object action, the Dropped Object gameobject switches to the torch holder object, not the torch gameobject I assigned when placing the initial torch. Ive tried various ways to fix this such as using a component variable, clearing the parent , nothing seems to work.

I'm fairly new to Adventure creator but not Unity , but this seems to be a bug.

Many thanks for any pointers.

https://imgbox.com/ScLIMO2c

Comments

  • Welcome to the community, @WRDwyer. Apologies for the trouble.

    Is the "Torch Holder" the same object that has the Hotspot component? I suspect this might be a case of the Hotspot setting its own GameObject to the parameter.

    If you view the Hotspot Inspector, check to see if its Hotspot parameter field is set to Dropped Object, which would override the values assigned in the Interaction field. This field automatically shows if the Interaction is an asset file with a GameObject parameter, so you might need to create a "dummy" GameObject to assign it to instead.

    However, it should be noted that parameter values within the Interaction component do not get stored in save-game files - so storing the held object as a GameObject component variable is the way to have the change be recorded.

    It's also possible to bypass the need in-scene Interaction object - and instead just have the Hotspot run the Torch Holder AL asset file directly. This can be done by setting the Hotspot's Interaction source field to Asset File. You can then set all of its parameter values with the Set Interaction Parameters component. This component bypasses any parameters set in the Hotspot component, so you wouldn't need a "dummy" GameObject with this method.

    I can elaborate on this change, but let's see if the above logic with the Hotspot parameter field was the cause of the issue first.

  • Thanks for coming back to me so quickly. I tried what you suggested but still had no joy. However, I have manged to get it to work. Im storing the Dropped Object into the GameObject temp component variable when adding the torch to the holder. To do the reverse, Im using the ActionList -> Set parameter, to copy the GameObject to the Dropped Object, Then parenting the dropped object to the characters hand!

    Apart from that little headache, I'm loving the tool. Thanks for your help.

  • Glad it's working, thanks for the details!

    If you want to learn more about how AC logic can be prefabbed, this tutorial covers the workflow with a few examples.

  • Thanks.

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.