右键创建mediaplayer,如图。
建立一个3D GameObject->Plane,如图。
在plane上加组件apply to mesh组件,制定刚刚新建的那两个东西。
.
控制视频播放
using System; using System.Collections; using System.Collections.Generic; using Leap; using RenderHeads.Media.AVProVideo; using UnityEngine; using RenderHeads.Media; using RenderHeads; public class VideoCtrls : MonoBehaviour { public Animator PlaneAnimatior;//让面板出现的animator动画 public MediaPlayer _MediaPlayer;//右键指定视频的插件组件 public GameObject PlaneGameObject;//面板本身 public ParticleSystem pm; private void OnTriggerEnter(Collider col) { if (col.tag=="Player") { Debug.Log("col"); StartCoroutine(wait()); } } private IEnumerator wait() { Debug.Log(("wait")); PlaneAnimatior.SetBool("Yes", true); yield return new WaitForSeconds(3.0f); _MediaPlayer.Control.Play(); yield return new WaitForSeconds(55.0f); PlaneGameObject.SetActive(false); } 使面板始终正对摄像机 using System.Collections; using System.Collections.Generic; using UnityEngine; public class TagFollow : MonoBehaviour { public GameObject m_Name; //面板 public GameObject point; //朝向点 void Update() { m_Name.transform.LookAt(point.transform.position); //面板看向的位置 m_Name.transform .rotation=Quaternion.Slerp(m_Name.transform.rotation,Quaternion.LookRotation(point.transform.position-m_Name.transform.position), 5 * Time.deltaTime ); } }