Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.Video;
  6.  
  7. public class PlayPauseButton : MonoBehaviour
  8. {
  9. PlayPauseButtonSprite ReferenceScript;
  10.  
  11. public bool play = false;
  12. private VideoPlayer videoPlayer;
  13.  
  14. void Awake()
  15. {
  16. videoPlayer = GetComponent<VideoPlayer>();
  17. }
  18. private void Start()
  19. {
  20. ReferenceScript = GetComponent<PlayPauseButtonSprite>();
  21. //videoPlayer.isLooping = true;
  22. }
  23. public void PlayPause()
  24. {
  25. if (videoPlayer.isPlaying)
  26. {
  27. videoPlayer.Pause();
  28. //ReferenceScript.Switch();
  29. play = true;
  30. Debug.Log(play);
  31. PauseImage();
  32. }
  33. else {
  34. videoPlayer.Play();
  35. play = false;
  36. Debug.Log(play);
  37. PlayImage();
  38. }
  39. }
  40. public void PlayImage()
  41. {
  42. Debug.Log("play");
  43. }
  44. public void PauseImage()
  45. {
  46. Debug.Log("pause");
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement