VideoPlayer.cs

using UnityEngine; using UnityEngine.UI; using System.Collections; using UnityEngine.Events; [RequireComponent(typeof(AudioSource))] public class VideoPlayer : MonoBehaviour { MovieTexture mt; AudioSource As; void Awake() { RawImage rim = GetComponent<RawImage>(); mt = (MovieTexture)rim.mainTexture; AudioSource audioSource = GetComponent<AudioSource> (); As = audioSource; As.clip = mt.audioClip; } void Start(){ mt.Play(); As.Play (); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.