Forum rules - please read before posting.

Noob item swap question


whats the best way to swap an item around in the scene?

I tried object replace but it said 'won't be instantiated, as it is already present in the scene'

Is there anyway I can just have one pgn and just show the next 'frame' on a action, then change the hotspot name

Or do I just teleport on image onto another image?

or should I just layer them on each other then use 'is visible' on interaction?

or have an animation the plays and stops on the last frame?

Sorry if it's been covered, i did check the tutorials and search the forums



  • Actually, all of the ways you've suggested are possible.

    You could instantiate the new object, but getting it to save properly is a little involved and too complicated for this scenario.

    If you don't mind giving each item a separate Hotspot, you can parent the object to the Hotspot, and then just control the position of each Hotspot. Place the "swapped in" item outside of the camera view, and then use a pair of Object: Teleport Actions to swap their positions. To store such changes in save games, you can then attach Remember Transform components to save their positions.

    To rely on one Hotspot, and you're dealing with sprites, you can instead use the Object: Visibility Action to make the first invisible, and the second visible. Attach a Remember Visibility component to both to store this change in save games, and set the "swapped in" item's Visibility on start field to Off.

    Finally, you could just animate the change so that you only rely on a single sprite object. Attach an Animator component, set up an Animator Controller, and then create animations that each cause it to show a different sprite. This is all using Unity's own Animator system, so check out Unity's tutorials on this for more guidance. Then define a bool parameter in your Animator, and set up transitions so that setting it to True shows the second sprite. With AC, you can then use the Object: Animate Action to change this parameter value at runtime, and hence change the sprite displayed. Again, to store such a change in save games, attach the Remember Animator component.

  • You are a gentleman and a scholar. Thank you v-much

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.