Need help making a SplashScreen based on a movietexture please!

Hi, this is my second post, well, actually i don’t know if this is the right place to post questions, let me know if i’m wrong

Well, i’ve been experimenting for a while with 1 movietexture in an empty scene, and my idea is simple:

First play the movietexture with fade in and out(done, i made the fade in and fade out by myself direcly in my video editor before importing into unity)

Then, wait for a configurable amount of seconds to load the next scene (the seconds of my movietexture)

I tried some codes like WaitForSeconds with the yield function but no luck, and i also tried making a timer which increments itself with Time.deltaTime and then something like

if ( time >= delayTime )
{
Application.LoadLevel(1);
}

but that only loads the level instantly, so i’m stuck right now

I also read that playing movietextures takes a lot of CPU power (really? how it is possible that the GPU is not enough to do this job?)

So, I was wondering too if there is a way or some suggestions to make the movietexture play more smoothly (i already now that it will play as fast as it can if Vsync is activated in the Player Settings, my current movietexture is 720p, 23fps)

Thanks a lot!

Can’t really help without seeing a code-snippet, because from the sound of it, there’s an error in your script. It should be pretty simple to do by creating a function to check if the MovieTexture is still playing, if it is, yield, otherwise load the next scene; which sounds pretty much like what you’re trying, correct?

Thanks!

Well, let’s see, this my actual code at the moment

#pragma strict

var movTexture : MovieTexture;

var delayTime : float;

function Start () 
{
    renderer.material.mainTexture = movTexture;
    movTexture.Play();
    
    print ("Starting " + Time.time);
	
    yield CargarNivel();
	
    print ("Done " + Time.time);
}

function CargarNivel()
{
    yield WaitForSeconds (11);
    Application.LoadLevel(1);
}

But before that, i tried this what was my first attempt

#pragma strict

var movTexture : MovieTexture;

var retraso : float;

Timer

function Start () 
{
    renderer.material.mainTexture = movTexture;
    movTexture.Play();
}

function Update()
{
    timer += Time.deltaTime;

    if( timer >= retraso)
    {
        Application.LoadLevel(1);
    }
}

Ok, hope this info will help you in helping me, thanks again!

As far as I can tell, your current code should work fine, but I’m not a JavaScript guy, so maybe I’m missing something.

Instead of manually supplying the seconds you could do something like this though:

#pragma strict

var movTexture : MovieTexture;
var delayTime : float;

function Start () 
{
    renderer.material.mainTexture = movTexture;

    movTexture.Play();
    yield WaitForMovie(movTexture);
    Application.LoadLevel(1);
}

function WaitForMovie(movie:MovieTexture)
{
   while(movie.isPlaying)
   {
      yield;
   }
}

Edit:
Alternatively, if you’re still having issues with it loading instantly you can try using Invoke()

Ok, i tried your first option, it works, so now i will see if reducing the resolution of my video will make it play at least a bit more smoothly, so thanks for the help!