LoadLevel() and implementing Loading Screens

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
kris_takahashi
Posts: 2
Joined: Sun Apr 01, 2018 3:19 am

LoadLevel() and implementing Loading Screens

Post by kris_takahashi »

Hi Tony, I'm new to Unity (started in March), and first off I have to say thank you for this asset, it's not just a great dialogue tool, it is an absolute foundational piece for whatever this thing is I'm making. I don't know if it'll ever be a game, but it would be nothing without your Dialogue System. Every day it continues to astound.

With that out of the way, I have about a million questions, but I think I'll just focus on the one I can't figure out a workaround for so as not to overwhelm. Anyways, I'm using LoadLevel() to switch between scenes, and even with a Fade(in, time) in front it gets a little wonky. I was wondering if there's a way to implement a loading screen or a fade that covers the duration of the transition. I've tried other third party loading screen assets but they don't seem to record the spawnpoint the way LoadLevel() sequence command does. This video illustrates the problem I'm having.



Going into the interior, it's so quick the fade works, but at the end of the video when I try exiting the building, it's slightly jarring as it takes a good long while to load. You can see it jump me to the level starting point before it moves me to the outside of inn/spawnpoint.

I should also note I'm a total beginner with zero programming experience, I started on this literally a month ago.
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: LoadLevel() and implementing Loading Screens

Post by Tony Li »

Hi,

That's looking pretty darn good for just starting a month ago!

Here's a set of example scenes: SceneTransitionExample_2018-04-01.unitypackage

To play them, import the package into a project that contains the Dialogue System, add ExampleScene1 and ExampleScene2 to your build settings, and play ExampleScene1.

Up through the current version, the technique to use the Fade() sequencer command with LoadLevel() involves an additional GameObject that I created and named "Black Screen" in the example. This GameObject covers the screen in black. In the upcoming version 1.8.0, the Fade() command will automatically create and manage this GameObject, but that won't help you right now. This GameObject is in a canvas that's a child of the Dialogue Manager so it will survive scene changes.

The sequence to move from ExampleScene1 to ExampleScene2 is:

Code: Select all

Fade(out,0.5);
SetActive(Black Screen)@0.5;
LoadLevel(ExampleScene2,Spawnpoint From ExampleScene1)@0.5
This fades to black over 0.5 seconds. At the end, it activates the Black Screen GameObject. Then it loads ExampleScene2.

In ExampleScene2, an empty GameObject named "Fade From Black" has a Sequence Trigger set to OnStart. In runs this sequence:

Code: Select all

Fade(in,1.5);
SetActive(Black Screen,false)@0.1
It fades in from black over 1.5 seconds. At the 0.1-second mark, it deactivates Black Screen. If your scene has elements that take more than 0.1 seconds to set up, you can increase 0.1 to a higher value. This will guarantee that the player can't see what's going on behind the scenes until Black Screen is deactivated.
kris_takahashi
Posts: 2
Joined: Sun Apr 01, 2018 3:19 am

Re: LoadLevel() and implementing Loading Screens

Post by kris_takahashi »

Thank you so much, this works great, and to think all I had to do was ask.
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: LoadLevel() and implementing Loading Screens

Post by Tony Li »

Happy to help! If any other questions come up, don't hesitate to ask!
Post Reply