Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Video Switch screen 10 seconds after video is finished

Discussion in 'Audio & Video' started by lsk111919, Sep 1, 2020.

  1. lsk111919

    lsk111919

    Joined:
    Jul 8, 2020
    Posts:
    19
    I try to go to the main screen a few seconds after the video is played, but it doesn't work well. I want to know what the problem is.
    Code (CSharp):
    1.  using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine.SceneManagement;
    4. using UnityEngine;
    5. using UnityEngine.Video;
    6. using UnityEngine.Timeline;
    7. public class Videoorigin : MonoBehaviour
    8. {
    9.      public VideoPlayer mVideoPlayer = null;
    10.      float time = .0f;
    11.      void Start()
    12.      {
    13.          Invoke("Awake", 30f);
    14.      }
    15.      private void Awake()
    16.      {
    17.          mVideoPlayer.loopPointReached += App;
    18.      }
    19.      void App(VideoPlayer player)
    20.      {
    21.          SceneManager.LoadScene("MainScenes");
    22.      }