- Home /
Playing a movie texture. No .Play() definition in UnityEngine.Texture class (Documentation seems to think there should be)
Hey,
I'm trying to play a movie that I have placed as a texture onto a material.
The movie texture script reference says the following:
// this line of code will make the Movie Texture begin playing
renderer.material.mainTexture.Play();
However the Texture class does not contain a definition for Play(). Can anyone tell me where I'm going wrong?
My object has several materials so I am referencing the one with the movie texture on using renderer.materials[index] but I've also tried on an object with just one material and referenced it via the the example code supplied above.
(renderer.material.mainTexture as $$anonymous$$ovieTexture).Play()
Answer by Meltdown · Jul 26, 2012 at 12:17 PM
Try this method as described in the documentation
Yea this is the method I went for in the end. Thanks.
How did you get this to work in the end? We have a game object prefab which is a TV screen, each component has a texture. The screen has a movie texture. The movie is the 3rd or index[2] texture. Putting this single texture on a cube and using the well established: function Start () { renderer.material.mainTexture = movTexture; movTexture.Play(); }
code to make it play works. But on the TV it doesn't.
I know we have to reference the materials array stack somehow (materials[2]?), but Unity scripting is quite new to us. Using either C# or Javascript, can someone please give a definitive code answer?
many thanks for any help
I'm guessing I'm a bit late to reply to this, sorry I didn't see it sooner. The only thing I can think of is that movie textures don't work without unity pro.
Answer by soulpsq · Apr 23, 2014 at 03:08 PM
You can see the site below, I think it can help you http://www.41post.com/3687/programming/unity-how-to-use-a-gui-texture-to-play-fullscreen-videos
Your answer
![](https://koobas.hobune.stream/wayback/20220613074726im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Changing two different objects renderer colour 1 Answer
Issue with Mesh Renderer and Skinned Mesh Renderer 0 Answers
Changing material of objects by the tag in different scenes 0 Answers
appear/disappear gameobject 3 Answers
SetFloat doesn't work 1 Answer