Forum rules - please read before posting.

Removing an object in code but Remembering that it's not visible

Hi Chris

What's the correct way to remove an object from a scene via code such that the visibility is remembered when the game loads?

Currently I default to Destroy() but I'm guessing that won't save the object status on game load.
I can also disable the mesh renderer, collider and hotspot, and put RememberRenderer, RememberCollider and RememberHotspot on the gameobject, but that feels...the wrong answer somehow.

Is there a better way?

Olly

Comments

  • The easiest way to remove an object's presence is to just move it off-screen, and let "Remember Transform" keep track of its position.

    This component can also record an object's presence in the scene, but it's a bit more tricky to set up. You need to make it a prefab, give it a unique filename, place it in a Resources folder. Then, in the Remember Transform component, check Retain in prefab? and Save scene presence?.

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.