Question by
leogetz · Nov 02, 2015 at 03:58 PM ·
unity 5soundontriggerentermovietexture
Script for Movie sound ontriggerenter in Unity 5
I have this by joining two pieces of code. It's working!
Can you tell me please how can I have sound on movietexture? I am not a programer.
#pragma strict
var movTex : MovieTexture;
var loop : boolean;
function OnTriggerEnter(other : Collider)
{
if(other.tag == "Player")
{
GetComponent.<Renderer>().material.mainTexture = movTex;
movTex.Play();
movTex.loop = true;
}
}
function OnTriggerExit(other : Collider)
{
if(other.tag == "Player")
{
GetComponent.<Renderer>().material.mainTexture = movTex;
movTex.Pause();
}
}
Thank you in advance!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612043641im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Audio Source does not contain definition for any of the Play functions... 2 Answers
How can I make a collider that gives me stat up to stop giving me it? 0 Answers
Having a OnTriggerEnter make another gameobject Add Force in UnityScript. 1 Answer
Looping wav creates gap between plays 0 Answers
C# How to play a sound ONCE when the gameObject tagged as , "Player" enters the trigger ? 1 Answer