fungus

Open full view…

How do you fade to a new scene?

academyoff
Sun, 08 Sep 2019 02:50:43 GMT

In a flow chart, I want the screen to fade to black, then I want it to fade in to a new scene. How do I do this? I see there's a LoadScene command, but from what I can see in the source, it does not fade. I know I could fade, then LoadScene, but I think it would immediately be visible once the scene is loaded. I don't want that to happen: I want it to fade in. How would I achieve that?

academyoff
Tue, 10 Sep 2019 01:57:14 GMT

I'd like to bump this. I've been unable to find anyone explaining how to do this when I google.

wolfrug
Tue, 10 Sep 2019 06:46:43 GMT

So, there are various ways, but in short: Fading the screen creates a CROSS SCENE fade effect - the actual fade effect is attached to the Fungus Manager, which is set to "Don't Destroy On Load", which means it persists between scene loads. So if you fade the screen before using a Load Scene command, the next scene will load while the screen is still faded. All you have to do then is make the first command in whatever starting flowchart you have be a "fade in" command, which removes the "fade out" effect. I noticed in another thread you tried to fade in after the load scene command, but that isn't going to work -> when using load scene, you UNLOAD the previous scene, which means all commands (flowcharts etc) in it are no longer processed, obviously. Just look at the scene inspector in play mode to see the names of the scenes you have loaded, and which are active. So: Scene 1 commands: Fade screen out. Load Scene ("Scene 2") Scene 2 commands: Fade screen in.

academyoff
Tue, 10 Sep 2019 07:28:30 GMT

OK that's helpful. Sorry, but all my questions kind of tie together into a cohesive story for me. There's another one where I ask if I *should* have one scene for my whole game. Let me give an example of why there's a lot of uncertainty for me when it comes to using multiple scenes: I have menus marked as "Hide if visited." I'm concerned that if I visit a menu, change scenes then come back to the original, Fungus won't keep track of the "visited" state unless I do something special. Or, does the Fungus Manager keep track of that state? I feel like my life will be harder if I have multiple scenes, but I don't know what I'll have to deal with that I would avoid if I just put everything in one scene. The reason I want to have multiple scenes is primarily because I already partially built my game using a Fungus alternative, and now I've decided I want to refactor the whole thing to use Fungus. It feels like quite a large change to take a multi-scene game and squash all the content into one scene. I'm trying to figure out which path would be less effort for me: Putting my existing content into one scene or figuring out how to use multiple scenes in Fungus.

wolfrug
Tue, 10 Sep 2019 08:09:11 GMT

It's fine to use multiple scenes! In fact if the game is bigger it's the preferred way of doing things. On the other hand it's also perfectly possible to make the entire game take place in one scene. Recently Unity has also allowed for multi-scene setups, although to make that work in Fungus you'd need some custom commands. Basically how you make it work is all up to you - but if you already have a multi-scene setup, I'd recommend keeping it! However, it's important to remember that whenever a scene is loaded and unloaded in Unity - all information stored in that scene is lost -. So any "hide if visited" checks and the like, any variable changes, any progress in a flowchart or whatever else is lost. There are ways to keep your things saved (lots of different threads in this forum for that), but that all requires organization and conscious effort; it's not automatic in any sense. Usually the best thing to do is not to save everything, but only pertinent things. For example, if you have a linear game where each scene is only visited once, there's no reason to save any inf ormation from the previous scene that isn't going to be used again in a future scene. As an example, in an RPG it might be important to save your XP, gold, inventory and health when transitioning to the next scene, but not which goblins specifically you killed, where their bodies lie, which chests exactly you opened, etc. However, if you travel from scene to scene and can go back and forth at will, you probably want to keep track of the state of each scene separately (now it's relevant how many goblins and where are still alive, which chests remain unopened etc). This gets more and more complex the more stuff you have that you'd need to keep track of, which is why it's so important you plan it out when you -start- the project. Unfortunately you're the only one who knows how your project is laid out, and the only one who can make that decision!

academyoff
Tue, 10 Sep 2019 18:13:16 GMT

Cool. Well I was just using the "Hide if visited" as an example. Is that really the only type of thing I have to think about when it comes to multiple scenes vs one; How/which state to carry over to scenes?