- Home /
Question by
PJEstrada006 · Apr 12, 2015 at 09:35 PM ·
texturebuttonvideo
Add a Movie Texture to UI Button
Hello,
I´m trying to add a movie texture to a UI button I have. I have a method that plays and stops the video when the button is pressed. However I´m not able to get the video to show in my game view. Can anyone help me to make it show up?
This is the script attached to my button and my editor
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(AudioSource))]
public class Video : MonoBehaviour {
public MovieTexture movie;
// Use this for initialization
void Start () {
renderer.material.mainTexture = movie as MovieTexture ;
movie.Play ();
}
public void PlayStop(){
if(movie.isPlaying){
movie.Pause();
}
else{
movie.Play();
}
}
}
1.png
(359.0 kB)
Comment
Your answer
Follow this Question
Related Questions
Flip UV x for renderer _MainTex that video player plays to 0 Answers
Show mouse click feedback on textured 2d plane button 2 Answers
Switch texture script malfunction 1 Answer
How do you auto scale the space between Gui Buttons? 1 Answer
How to change RawImage texture to another one when i press a buton for it 0 Answers