Hello! The last week I’ve been working on transitioning gracefully between scenes in the Glace remake. I’m using Unity, so the word “Scene” here is a proper noun. I didn’t have much experience with this so got to learn some new stuff.
There are some common challenges regarding all this. One being that when you load a new scene, Unity tears down your current scene in some non deterministic fashion. Unity just starts disabling and destroying components and game objects seemingly at random. This is basically the same way Unity works at scene creation, so it’s not a new paradigm, but it’s easy for me to forget. Even after a component is up and running nicely, you still can’t assume that its dependencies will be around in the future.
Another issue is synchronizing services between scenes. I’m doing my best to minimize the state that sticks around between scene loads. I’m heeding the warnings of my predecessors about the dangers of having scenes that know anything about the scenes that came before them. Basically if you have a scene that requires other scenes to be loaded before it you will be sad and your turtle will be disappointed in you. So none of my services even stick around between scenes. They all get torn down and then recreated if they’re needed in the next scene. Any state I want to keep is handled by configuration assets AKA ScriptableObjects.
Let’s see what else? Well one of the things that a scene passes to the next scene (through those config assets) is at which spawn point the turtle should appear in the next scene. This way when you warp out of a stage you’ll appear where you expect on the overworld. This let’s me do some interesting linking between stages and the overworld too. At some point I’d like to experiment with using stages as a way to move around the overworld. For example on the overworld you would go into the entrance of a cave. You’d enter a spooky cave stage with turtles in it. You’d get through the cave stage and when you exit at the other end, you’d appear on the other side of the mountain on the overworld. On a beach. The only way you can get to this super secret turtle beach is through this turtle cave. Maybe you’d unlock a turtle gate stone at the beach so you can turtle back without having to turtle through the turtle again. Or turtle not, but I always turtle off fast turtle on all the games I turtle. Who knows. Ok more work to do. Thanks for reading.
Oh, here’s a gif just for fun of some lighting experiments: