- Home /
How to loop a video texture in C#
Im still new to C# programming I am familiar to all the types of loops but I am stumped on how to implement it in Unity here is what I have so far.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour {
public MovieTexture movie;
// Use this for initialization
void Start ()
{
{
GetComponent< RawImage> ().texture = movie as MovieTexture;
movie.Play ();
}
// Update is called once per frame
void Update ()
{
}
}
Answer by Lysander · Jan 01, 2018 at 12:15 PM
AFAIK you don't actually need to- just check the "loop" box in the inspector when the MovieTexture is selected, and it should loop. If you need to do this programmatically for some reason, then movie.Loop = true; should work. I suppose if you want to loop it in one instance, without looping it for all of them, then just put something like if(!movie.isPlaying) movie.Play(); in the Update function.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Coroutine For Loop Will Not End 1 Answer
GST Movie Texture - How to mute video?? 0 Answers
Movie/Video Texture 0 Answers
Video Texture Loop 2 Answers