- Home /
Multiple Splash Screens for a game intro?
Hello all,
I need some help with a game intro I am working on. When the game first boots up I need it to display multiple splash screens that fade in and out. I am using Unity Free. I'm not sure how to achieve this effect... I have multiple JPEG graphics that I need to fade out, wait a few seconds, then fade the next one in, and so on for 8 different images. If anybody can help me out, I would appreciate it so much.
Thank you for all your help!
Answer by Tomer-Barkan · Nov 19, 2013 at 04:36 PM
You can simply load a few scenes one after the other...
using UnityEngine; using System.Collections; using System.Collections.Generic;
public class ImageDisplay : MonoBehaviour {
public Texture imageToDisplay;
public float timeToDisplayImage;
public int nextLevelToLoad;
private float timeForNextLevel;
public void Start() {
timeForNextLevel = Time.time + timeToDisplayImage;
}
public void OnGUI() {
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), imageToDisplay);
if (Time.time >= timeForNextLevel) {
Application.LoadLevel(nextLevelToLoad);
}
}
}
Now, create a scene for each image you want to display, and add them to the build order (see how: http://docs.unity3d.com/Documentation/Manual/PublishingBuilds.html).
In each scene that you want to display an image, add the script above to the camera. Then in the inspector, assign the following variables to the script:
Assign the image you want to display to imageToDisplay
In timeToDisplayImage
enter the time you want the image to be shown in seconds
In nextLevelToLoad
enter the number of the next level you want to load, according to the order you put them in the build settings.
Good luck.
this worked great! but is there a way to make it fade slowly into next level? thank you
Thanks a lot man !!! Thanks for sharing this with us!!! appreciate your support !!! so helpful !!! I would vote you if I had points (I'm a newbie)
Answer by matheusrma · Sep 10, 2014 at 11:29 AM
If you are still having a hard time working a good looking splash screen, check it out my Asset Store package.
https://www.assetstore.unity3d.com/en/#!/content/9918
You can get a professional splash screen in less than 3 minutes using the build in examples
Your answer
Follow this Question
Related Questions
Fading from my splash screen 1 Answer
alpha value not changing(gradual decrease) during runtime 1 Answer
Fade In And Out (GUIText) 0 Answers
fade in fade out audio manager 0 Answers
How can I make a fade out transition when i change a culling mask? 0 Answers