- Home /
Loading Screen
Hello everyone,
I'm trying to implement a loading screen. At the menu you press play. The loading screen appears. I'm trying to implement a flag blowing in the wind but instead a black screen appears. About nine seconds later the actual game loads. So, the functionality is there. The problem is that I'm getting a black screen. Here's my code:
#pragma strict
var async: AsyncOperation;
var movTexture : MovieTexture;
function Start () {
async = Application.LoadLevelAsync ("Stampede");
yield async;
renderer.material.mainTexture = movTexture;
movTexture.wrapMode = TextureWrapMode.Repeat;
movTexture.loop = true;
movTexture.Play();
}
function Update () {
var progress = async.progress;
Debug.Log(async.progress);
}
My movTexture is a file of a flag blowing in the wind.
Any help is appreciated. Thank you for your time.
Try playing the movie, and then starting the load. And remove the "yield async". Its not necessary the way you're using it.
Answer by whebert · Apr 10, 2013 at 12:19 AM
Just flip the order of when you play the movie in Start ought to do it. The way you have it now, you yield until the level is loaded, so your movie never gets played.
function Start () {
renderer.material.mainTexture = movTexture;
movTexture.wrapMode = TextureWrapMode.Repeat;
movTexture.loop = true;
movTexture.Play();
async = Application.LoadLevelAsync ("Stampede");
yield async;
}
But your level does load eventually, yes? If the level takes some time to load, longer than your video, then the video should loop since you set loop = true.
The problem was that the async operation doesn't work properly in the editor. It does work in the player.
Answer by SheZii · Jan 30, 2019 at 07:50 AM
Detailed Unity3D Actual Loading Screen Tutorial (With free C# Script and Demo project) http://techscenarios.com/2019/01/unity3d-add-loading-screen-to-your-game/
Or watch it on Youtube https://www.youtube.com/watch?v=fx9XjUS1VEQ
Your answer
Follow this Question
Related Questions
How do I play a full screen video? 4 Answers
Using a GUI Movie Texture (making it appear and disappear correctly) 2 Answers
How to use FullScreenMoviecontrolMode 0 Answers
play movie on trigger 0 Answers
seeking video by using audioSource.time not working 0 Answers