using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Video; public class VideoManager : MonoBehaviour { private VideoPlayer videoPlayer; public float speed {get; set; } public float raceFinishTime = 30.0f; public int videoID; void Awake() { //videoPlayer = gameObject.AddComponent(); } VideoPlayer GetVideoPlayer() { if (videoPlayer == null) videoPlayer = gameObject.AddComponent(); return videoPlayer; } void Start () { // TODO: Aspect Ratio is not working? var vp = GetVideoPlayer(); vp.aspectRatio = VideoAspectRatio.FitOutside; Debug.Log(vp.aspectRatio); vp.isLooping = true; vp.playOnAwake = false; vp.Prepare(); vp.Pause(); //videoPlayer.Play(); Run(); } public void SetSkin(int playerID) { Debug.Log("PID: " + playerID); int id = GameManager.Instance.GetSkins(playerID); Debug.Log("PID: " + playerID + " id: " + id); var vp = GetVideoPlayer(); vp.url = Application.streamingAssetsPath + "/" + id + ".webm"; } void Update () { videoPlayer.playbackSpeed = speed; } void Run() { videoPlayer.Play(); } void WheelImpulse() { } }