Displaying particle effects on a loading page

I am trying to display particles that I have created during the loading page and used a script like this

using UnityEngine;
using System.Collections;

public class TimeSplash : MonoBehaviour 
{
	public int SplashTime = 10; //seconds
	public string SceneName;
	
void Update ()
{
	if( Time.time > SplashTime )
		{
		Application.LoadLevel(2);
		}
	}
}

Whats happening now is basically it’s not displaying the page for 10 seconds it automatically loads the second level so I can’t see my particle effects. But I am trying to display those particles for 10 seconds then load another level. Any ideas guys ? Cheers

the problem is that you need to use Start to define a point at which this splash started. right now you only check if the app ran for more than 10s already, which is likely granted to be true so direct loadlevel

Could you please give me an example because I am not really good with C# language. Thanks again

Guys anymore ideas ? Thanks

This is nothing about C#, would work the same in any language.

Your problem is that you measure if the time is larger your 10s, which is always true basically. What you in reality want to do is test if the time DIFFERENCE since the wait started is larger than 10s

So you would add a variable to store the start time and assign the current time at the point of Start() in it and then in update you would do the load level.

BUT: I wouldn’t do that. Actually I would use a coroutine thats started in Start() and just put a yield return new WaitForSeconds(xxx) at the beginning and load level after. Reason is that while Update looks light, overusing it can break your neck on lower end devices or mobile as it just wastes precious frametime for nothing. Also coroutine in this case is far easier to handle and read

Right okay I got what you mean now :slight_smile: I’ve used yield function to do that. Thanks again for the info :slight_smile:

Also, if you have a particle effect that you want to show mid stream. (That is you want it to start building before the first frame, like a nice fire plume or such), use the ParticleEmitter.Simulate method.

Hello BigMasterB, I didn’t get what do I need to use this method exactly ? Thanks

The time you want to simulate “instantly” so you are at a point the particle system would be if it ran XXX milliseconds from now on.

the other thing you need is naturally the particle emitter to call it on as its not a static method, its a method of an instance of a particle emitter