Hello !
I’m working on a project where the user is within a 360 video playing on skybox. The problem is that I’ve made the video prepare and then play on prepare completed. Still, even with a preload of shader applied to video, the video starts to play before actually rendering (I can see my GUI appearing before I can actually see the video playing, while it’s activating the same time as my video based on script).
Here is my piece of code for synchronizing my video, GUI and animation :
using UnityEngine;
using UnityEngine.Video;
public class StartAnimOnTime : MonoBehaviour
{
[SerializeField]
private VideoPlayer videoPlayer;
[SerializeField]
private Animator animator;
[SerializeField]
private GameObject canvas;
void Awake()
{
videoPlayer.prepareCompleted += StartVideo;
videoPlayer.started += startAnim;
}
private void Start()
{
videoPlayer.Prepare();
}
private void StartVideo(VideoPlayer source)
{
Debug.Log("START VIDEO");
source.Play();
}
private void startAnim(VideoPlayer source)
{
canvas.SetActive(true);
animator.SetFloat("Speed", 1);
}
}
Thanks for the reply !
Dighim