I have a gameObject with two planes in it. Each plane has a movieTexture attached to it.
I have a C# script attached to this object. How can I access these movieTexures in my script? I am trying to access them like this:
public class MyClass: MonoBehaviour
{
public MovieTexture movie;
public MovieTexture movie2;
Material[] materials;
void Start()
{
movie = materials[0] as MovieTexture;
movie2 = materials[1] as MovieTexture;
}
}
But I get this error:
“Cannot convert type ‘UnityEngine.Material’ to ‘UnityEngine.MovieTexture’ via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion”