Unity Ver: 2019.4.8f1
AC Ver: 1.71.8
Hello,
I'm just after best practice for having a gameobject disabled at the start of a scene, which would then be enabled later on.
Previously, I've been disabling the object in the scene via the inspector and then using Object:Call Event to turn it on, however I'm sure I've caught posts here that suggest that isn't considered the safe way to do things.
Alternatively, there is a Remember Visibility component that can be attached to the object and the 'visibility on start' set to 'off'. That's good, however the collision of the object remains. In my case I want the object to be disabled entirely - no visuals, no logic and no collision active on it.
What's the appropriate way of doing this?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
It mainly depends on whether or not you want to record its on/off state in save games.
If so, then disabling it can prevent it from being "found" by the save system when attempting to update it upon loading.
The easiest way is to just keep it hidden from view, by e.g. placing it under the floor. An Object: Teleport Action can then place it in view when ready, and the Remember Transform Action can keep track of its position.
Slightly more complicated alternatives include:
Morning Chris,
Indeed in my case the recording of it's state would be important, so that's good. That means inspector disabling is a total no go from now on.
I love the Object: Teleport idea!