Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.Video;
- public class VideoPlayerInput : MonoBehaviour
- {
- private VideoPlayer videoPlayer;
- private void Awake()
- {
- videoPlayer = GetComponent<VideoPlayer>();
- videoPlayer.Prepare();
- }
- private void Update()
- {
- if (Input.GetKeyDown(KeyCode.Space))
- {
- TogglePlay();
- }
- }
- private void TogglePlay()
- {
- if (!videoPlayer.isPlaying)
- videoPlayer.Play();
- else
- videoPlayer.Pause();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement