Unity の VideoPlayer コントロールの再生が完了しました

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;

public class testVedio : MonoBehaviour
{
    public GameObject go;

   public  bool ison1 = false;
    // Start is called before the first frame update
    void Start()
    {
        Invoke("Setison",3);
    }

    void Setison() {
        ison1 = true;

    }

    // Update is called once per frame
    void Update()
    {
        if (ison1) {
            if (GetComponent<VideoPlayer>().isPlaying)
            {
               // Debug.Log("frame"+ (ulong)GetComponent<VideoPlayer>().frame);
                if ((ulong)GetComponent<VideoPlayer>().frame >= GetComponent<VideoPlayer>().frameCount-1)
                {
                    Debug.Log("sssss");
                   // GetComponent<VideoPlayer>().Pause();
                    go.gameObject.SetActive(false);

                    ison1 = false;
                }
            }

        }
       
    }
}

おすすめ

転載: blog.csdn.net/qq_37335907/article/details/120061575