- Home /
How do i make a Video Intro at the start of a game using Java Scripting?
How to i make a video intro that show like some form of presentation like "A Unity Game" then "Powered By Unity" using the free version of Unity?
If you mean the WebPlayer embedded on the webpage, i would use the Javascript. I would define an additional video div and set the Unity div display to none and then switch that by "Send$$anonymous$$essage" after the game loads
Unfortunately you cannot play videos in Unity Free, but there is a solution for playing a 'slide-show' that acts as a video : http://forum.unity3d.com/threads/100174-HOW-TO-Play-Videos-Without-Pro
but otherwise, from within Unity you need the Pro version : http://answers.unity3d.com/questions/40762/i-havent-pro-that-means-i-cannot-play-videos.html
You could always just use 'splash' screens : http://wiki.unity3d.com/index.php/SplashScreen
No i am talking in Unity, i use JavaScript to tell Unity to play this Video before loading the main menu or anything else...
You won't get far with this if you are unwilling to read.
Answer by smirlianos · Jan 06, 2013 at 07:39 PM
If you mean that you want an image to show BEFORE the pre-made unity logo that is showing before the game starts, you can't. But if you want it after that and before the first scene (scene 0) use this script. Put it on any game object and drag the png file you want in the inspector!
#pragma strict
// FadeInOut
var fadeTexture : Texture2D;
var fadeSpeed = 0.2;
var drawDepth = -1000;
private var alpha = 1.0;
private var fadeDir = -1;
function OnGUI(){
alpha += fadeDir * fadeSpeed * Time.deltaTime;
alpha = Mathf.Clamp01(alpha);
GUI.color.a = alpha;
GUI.depth = drawDepth;
GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), fadeTexture);
}
works great, how do i set more than one photo to display?
I'm afraid I don't know how to do this... But you can try to change scene automaticly when the first image fades out, and have the same script in the second scene as well with a different image in the inspector this time
Answer by FL · Jan 06, 2013 at 07:25 PM
Create a scene with these text/image done by GUI and use a script like:
var timeWait : float = 10.0; // Time for load the scene
var sceneName : String = ""; // Name of Scene that will be load
private var timeStart : float = 0.0;
function Start(){
timeStart = Time.time;
}
function Update (){
if (Input.anyKeyDown || (timeStart+timeWait)<Time.time)
Application.LoadLevel(sceneName);
}
i don't understand, i want to use a video or if i can't use videos i want to use .PNG files to present it. Please explain?