Hi all,
I had a look around and couldn't find a solution to this. I've been playing with the add and remove scene script to add a subscene for close up scenes, while still having the existing scene visible in the background. The new scene I add switches to its Game Camera on start, and upon clicking a hotspot the new scene switches back to the previous game camera and removes itself. This all works fine, but as I suspected this may have been an uncommon scenario I wanted to make sure save/load worked fine.
The problem I am noticing is that when I save the game while I have the subscene visible, when I load the active camera is often the master scene's camera, rather than the subscene. In addition to this, and perhaps of bigger concern, sometimes I notice that the subscene gets loaded twice upon load, and in these cases the active camera is the subscene game camera. That problem aside, I have made sure to "Auto Add Save Components to GameObjects" in both scenes, so the game cameras have constant id's, and I tried adding Remember Transform and Remember Visibility scripts to the game cameras, but this didn't work.
Anyone have any experience with this, or a better way to handle the close up scene scenario (which has the parent scene still visible in the background)? Another scenario which may work would be to put the subscene in a prefab and load that, but that could cause more headaches with save/load. Alternately, if I need to abandon playing with subscenes because it will cause me headaches down the road I'd like to find out now.
Update: I did some further testing and found that when the game is loaded the player will cause a trigger to fire its enter event if it is loaded inside the trigger. I figure this shouldn't happen, but does anyone know a way to fix this? Note: The trigger does have the Remember Trigger script.
Comments
While not a commonly-used feature, using subscenes in this way should be viable from the sounds of it - but there's not yet enough detail here to be able to recreate the issue and work out the problem.
First of all, what are your AC and Unity version numbers?
The standard AC GameCameras need no Remember components unless you're spawning them in at runtime individually - they should only have Constant ID components here.
As you're reporting a number of issues that are all interconnected, I think it'll be best for me to see this all for myself. If you can create a stripped-down copy of your project (just these two scenes, no audio/animation/graphics used elsewhere), PM it to me along with details on how to recreate the issue and I'll see what's going on.
-chris
With regard to having a Camera in a subscene that you switch to, at current this doesn't play nicely with Save/Load, so I'd recommend avoiding it. I'm going to investigate putting a subscene in a parent game object and doing a show/hide of that object when I want the subscene to appear. This will not work very well if I want the subscene to be able to pop up in any scene, so if I ever need that scenario I'll have to figure something else out.