Hi folks,
The 'remember' functions seem pretty straightforward, but I can't seem to get mine to work right when saving and loading to the same scene.
The example I have here is: I have a 2D Mesh Collider in a scene. After an action (let's call it ActionA), the mesh is removed from the scene. Pretty basic, works fine.
But I want to make sure the collider status persists across savegames,so I add a Remember Collider script to it, using the default settings.
Now I save the game, then perform ActionA, removing the collider. Then I reload the game from within the same scene, the collider is not there, although I'm reloading to before ActionA.
However, if I leave the scene before reloading, and then reload the save from another scene, the mesh is restored as it should be.
To summarize, the Remember Collider script seems to work only when loading from another scene. I've had similar problems with other Remember scripts, always having to do with reloading from within a scene.
I'm committed to v1.46 at the moment, and I've searched the patch notes since that release, but not seen anything indicating that this needed a fix. So maybe I'm just not understanding something about 'remember' components.
Any explanations for this rookie scripter?
Comments
If you're removing the collider gameobject from the scene/hierarchy, you'll need to attach the RememberTransform component instead, as this also has the option (as well as storing it's position) to store the object's presence within the scene. You'll also need to make the object a prefab and place it in a Resources asset folder (again, see the Manual), but for simplicity you're probably better off simply disabling the Collider component or moving it out of view.
The added compexity involved in this, however, is why I recommend simply hiding such objects from view wherever possible.