Hello, I am wondering how I would apply a movie file onto a gui and have it play when the game starts and then switch over to the scene “mainmenu” I have tried and I couldn’t get it to work, thanks!
I’d read over this page for the usage of Movie Textures (http://docs.unity3d.com/Documentation/Manual/VideoFiles.html) and one way you could achieve it before the scene, is to have it be contained within its own scene then use Application.LoadLevel(“mainmenu”); once the video has finished playing.
I read that page just don’t know which script to use that makes it so instantly when the game plays it starts it. Plus I want it in a GUI so I don’t have to rotate it and get it exact so it doesn’t look too sideways etc if I were to apply it onto a plane.
If you are having to rotate a plane to get it facing the correct direction, I would think you would want to adjust that outside of Unity within your video editor. As for having it play once the game starts, have it placed within the scene that is loaded first and create a derived MonoBehaviour that calls the Play method of your material within the Start method defined in your class.
Sorry, I am kind of new to all this really and somewhat didn’t understand what you said. I should have said to put it noob friendly.
You said to edit it outside Unity, I just drag the video texture onto the plane but when I put a camera onto the scene I have to rotate the plane within Unity and get it perfect (which I can’t do) In order to make it look not slanted etc. I have the scene created and the plane do I just drag the script in the link you sent me onto the plane? Because when I do that and press play it either pauses the game instantly or when I try with a GUI says I need a renderer or if I do apply it to a plane it doesn’t play when the level is loaded, thanks again.
What I was trying to say, was that if the video that you have needs to have the plane on which it is playing rotated to be displayed correctly, wouldn’t you be better off doing that rotation within your video editing software so that it ‘just works’ within Unity?
As for the script, the one in the link won’t do what you are looking for, it is mearly there as a quick reference for how you may script something with a material using a video as the texture. What you are going to want to do is create a new script, either C# or UnityScript which ever you prefer, and then write a Start method which contains the following line renderer.material.mainTexture.Play();, after that is completed, you are going to need something close to the following within an Update method you must also write.
if(renderer.material.mainTexture.isPlaying == false)
{
Application.LoadLevel("YourLevelNameHere");
}
The code you put is so when it is done playing it results to false and goes onto loading the level “YourLevelNameHere” what scripts starts the video when I load it would it be this
function Start(){
renderer.material.mainTexture.Play();
}
Correct, on both counts. The snippet that I posted above will check every time the class Update method is called to see if the isPlaying property has returned false, finished playing, and at that point will call the LoadLevel method.
Oh okay thanks for helping! Did the script I put up there should I just apply it to the plane with the movie texture on it?
Hopefully after a year or 2 on the forums I will be able to code on my own!
Use a cutscene editor