- Home /
Video texture problem?
Hello!
I use this script to make the video texture start, but it gives me these errors:
Assets/Scripts/Js_TV.js(12,51): BCE0019: 'isPlaying' is not a member of 'UnityEngine.Texture'. Assets/Scripts/Js_TV.js(13,55): BCE0019: 'Pause' is not a member of 'UnityEngine.Texture'. Assets/Scripts/Js_TV.js(16,55): BCE0019: 'Play' is not a member of 'UnityEngine.Texture'.
function OnTriggerStay (other : Collider) {
if(other.gameObject.tag == "Player")
{
if (Input.GetKeyDown(KeyCode.Space))
{
if (renderer.material.mainTexture.isPlaying) {
renderer.material.mainTexture.Pause();
}
else {
renderer.material.mainTexture.Play();
}
}
}
}
Answer by Sanky · May 12, 2013 at 11:56 AM
this code will work perfectly for you.
var movTexture : MovieTexture;
function Update () { if (Input.GetButtonDown ("Jump")) { if (movTexture.isPlaying) { movTexture.Pause(); } else { movTexture.Play(); } }
}
Thanks! It worked!
Any idea why the previous script doesn't work?
from unity forum renderer is not support to isPlaying because it is boolean method so that's why.
ok best luck
Answer by once2go · Jan 21, 2014 at 04:26 PM
Searching for C# and find =)
MovieTexture mov;
void Update () {
mov=(MovieTexture)renderer.material.mainTexture;
mov.Play(); }