system
1
I have been able to play videos when they are added to planes as textures, but I'm struggling with playing a video with onGUI();.
I can call the MovieTexture as a variable, but controlling when the user plays and stops this video is baffling. I'm not sure where this code should go. Can anyone help? Thanks!
system
2
You can use GUI.DrawTexture method. Exemple in C#:
public class C : MonoBehaviour
{
public MovieTexture movie;
void OnGUI()
{
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), movie);
}
}
it's a good idea to ask other questions seporately but i'll answer this one here.
so the question is how can i create GUI for playing and stoping the movie?
I'll write js code because C# programmers understand js code but js programmers can not understand C# code easily.
var m : MovieTexture; //you should set this to the movie that you want to play
var playButtonString="play"; //string shown on the play button
function OnGUI ()
{
GUI.DrawTexture (Rect (0,0,640,480),m);
if (m.isPlaying == true)
playButtonString="pause"; //it's playing so the button should pause.
else
playButtonString="play"; //it's not playing and the button should play the movie.
if (GUI.Button (Rect (500,10,100,30),playButtonString) == true)
{
if (m.isPlaying == true)
m.Pause();
else
m.Pause();
else
m.Play();
enter code here
}
if (GUI.Button (Rect(500,120,30),"Stop")==true)
m.Stop();
}
system
4
what formats are supported?