PlayeVideoModel.cs 655 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Video;
  5. public class PlayeVideoModel : MonoBehaviour
  6. {
  7. public VideoPlayer videoPlayer;
  8. public SCButton playBtn;
  9. public SCButton pauseBtn;
  10. private void OnEnable()
  11. {
  12. videoPlayer.Play();
  13. }
  14. public void PlayVideoOnClick()
  15. {
  16. playBtn.gameObject.SetActive(false);
  17. pauseBtn.gameObject.SetActive(true);
  18. videoPlayer.Play();
  19. }
  20. public void PauseVideoOnClick()
  21. {
  22. playBtn.gameObject.SetActive(false);
  23. pauseBtn.gameObject.SetActive(true);
  24. videoPlayer.Pause();
  25. }
  26. }