Loading Screen Problem

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
lardmaster
Posts: 18
Joined: Thu Jun 25, 2020 9:17 pm

Loading Screen Problem

Post by lardmaster »

Hey Tony,
I'm having a problem making the transition between scenes go smoothly. The animation I play for scene transition occurs after the dialogue that happens at start of scene transition when i would like the dialogue to start after the animation is done playing. Also, the loading screen scene only pops up for a short amount of time and i would like it to last for a couple seconds and for the character animation i have in my loading screen to not lag.

heres what my scene transition component in the inspector looks like:
Annotation 2020-08-06 005148.png
Annotation 2020-08-06 005148.png (41.78 KiB) Viewed 1031 times
heres what my problem looks like with the show and hide animations only occuring after scene change:


another example with a longer scene change where u can see the character animaton in loading screen lagging:


What can I adjust so that the show animation plays, then the loading screen appears for 2 seconds, then the hide animation plays, to reveal the new scene as opposed to new scene showing before the show and hide animations. Also, my loading screen animations lag as well, is there a way to get them to play smoothly while loading new scene?

ALSO sorry if this is too much, but I had a quick question regarding the save system. If I want to save a custom data object like a listarray of my own class Card that persists in every scene, do I have to write my own custom saver component or how would I go about integrating it with dialogue system's save system?

Thanks for all your help! I really appreciate it.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Screen Problem

Post by Tony Li »

Hi,

Set the Leave Scene Transition > Animation Duration to the length of your leaving animation (e.g., fade to black).

Set Leave Scene Transition > Min Transition Duration to that length + 2 seconds.

Unity controls the animation in your loading scene. There isn't much you can do about it. It should be much smoother in a build than in the editor.


> If I want to save a custom data object like a listarray of my own class Card that persists in every scene, do I have to write my own custom saver component or how would I go about integrating it with dialogue system's save system?

Yes, write a saver component. Duplicate Plugins / Pixel Crushers / Common / Templates / SaverTemplate.cs, rename it, and add your code where the comments indicate. Then add the script to the GameObject with the Card class.
lardmaster
Posts: 18
Joined: Thu Jun 25, 2020 9:17 pm

Re: Loading Screen Problem

Post by lardmaster »

Hi,

thanks for ur response! It worked pretty well, but now the loading screen does not appear at all, the screen is just black for several seconds in between scene transitions. I think it is because the animation lasts too long when i set the min transition duration to 3 for the show animation, and the black screen in the animation is covering the loading screen. Is there a way to make the loading screen appear or disable the animation when in loading screen scene?
Also can I set the loading screen to be a certain length? So rather than extending the animation through the min transition duration field in the inspector, I would be extending the length of the loading screen while waiting for everything in the new scene to load.

Thanks for all ur help!
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Screen Problem

Post by Tony Li »

There are two ways to make the loading screen appear.

The first is easiest. Make your loading screen sit on top of the black screen. For example, if you're using the default SceneFaderCanvas that ships with the Dialogue System, its canvas order is 998. Set your loading screen canvas's sort order to 999. Increase the Leave Scene Transition's Min Transition Duration to stay on the loading screen longer.

The second is to set the Leave Scene Transition's animation to fade to black, then fade in from black and then fade back to black. For example, say your Leave Scene Transition's animation has this timing:
  • 0:00 - Start fade to black
  • 0:02 - Finish fade to black (i.e., take 2 seconds to fade to black), and start fading in from black
  • 0:03 - Finish fade in from black (i.e., take 1 second to fade in)
  • 0:05 - Start fade to black
  • 0:06 - Finish fade to black (i.e., take 1 second to fade to black)
Set the Leave Scene Transition's Min Animation Time to 2 seconds. The loading scene will load at the 0:02-second mark.

By the 0:03-second mark, the fade will be gone, and the player will see the loading scene.

Set the Min Transition Duration to 6 seconds. The loading scene will be loaded at the 0:03-second mark. At the 0:05-second mark (i.e., 2 seconds later), it will fade back to black and then load the next scene.
lardmaster
Posts: 18
Joined: Thu Jun 25, 2020 9:17 pm

Re: Loading Screen Problem

Post by lardmaster »

Tony thank u so much once again! The second method worked perfectly for me and the animation somehow fixed itself too. Ur amazing!

Also quick question on the custom saver template. Is there any documentation or past examples to point me towards how to write this script as i am not familiar with coding save systems and am still kind of a c# noob? I looked through the code comments in the saver template and am not sure where to start so if there's any resources to guide me along that you could point me to that would be helpful!

SORRY another quick question. I've been using scene portal to change scenes and I was wondering if there was a way for scene changes to remember where u last were instead of having to create a gameobject for every different scene change and spawning the player at the gameobject. Is this feasible or not with something like position saver component so i dont have to continuously make gameobjects? This could be problematic as i have a lot of battles in my game and each battle is set in a different scene, so for every battle i would have to make a new gameobject to spawn the character back in the right place. Im sorry to be asking so many questions, ill rly try for this to be my last one for a while haha. Youve been a humongous help and i cant thank u enough
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Screen Problem

Post by Tony Li »

Hi,
lardmaster wrote: Fri Aug 07, 2020 3:39 amIs there any documentation or past examples to point me towards how to write this script as i am not familiar with coding save systems and am still kind of a c# noob?
This post has an example saver that saves Enviro: Sky and Weather. It's a typical example of a saver script.
lardmaster wrote: Fri Aug 07, 2020 3:39 amI was wondering if there was a way for scene changes to remember where u last were instead of having to create a gameobject for every different scene change and spawning the player at the gameobject.
Yes. Tick the Position Saver's Multiscene checkbox. It will remember the last position in each scene. However, if you specify a spawnpoint, it will move the player to that spawnpoint instead of the last position. If you don't specify a spawnpoint, it will move the the last position.
lardmaster
Posts: 18
Joined: Thu Jun 25, 2020 9:17 pm

Re: Loading Screen Problem

Post by lardmaster »

Hi,

Thanks, the multiscene option worked perfectly. didnt know itd be that easy haha
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Screen Problem

Post by Tony Li »

Glad to help!
Post Reply