- Home /
Question by
El Maxo · Sep 04, 2015 at 01:36 PM ·
c#movietextureraw
Changing Movie Textures.
Hello all,
I currently have a Movie texture that is running on a raw image on the UI in my scene.
As it currently stands I am getting the issue that it wont convert my textures. I must be doing something wrong as i just want to replace what is in the texture field of the raw image.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class updateplayer : MonoBehaviour {
public RawImage movietexture;
MovieTexture mt;
public MovieTexture Movie1;
public MovieTexture Movie2;
public int Movienumber;
void start(){
Movienumber = 1;
}
void Update () {
if (Input.GetKey (KeyCode.A)) {
mt = (MovieTexture)movietexture.mainTexture;
if (mt.isPlaying) {
mt.Pause();
}
else {
mt.Play();
}
}
if (Movienumber == 1) {
movietexture = Movie1;
}
if (Movienumber == 2) {
movietexture = Movie2;
}
}
public void add(){
Movienumber = Movienumber + 1;
}
}
Comment
Best Answer
Answer by El Maxo · Sep 04, 2015 at 02:39 PM
Sorry guys answered my own question.
You simply turn movietexture = Movie1; to movietexture.texture = Movie1;
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Video Scrubber Bar & Rewind using MovieTexture? 0 Answers
UI Escape menu script not working. 2 Answers
Renderer component MovieTexture 0 Answers