Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Video;
- public class VideoPlayerControlSwitch : MonoBehaviour
- {
- public bool toggle = true;
- VideoPlayer vPlayer;
- // Use this for initialization
- void Start()
- {
- vPlayer = gameObject.GetComponent<VideoPlayer>();
- }
- // Update is called once per frame
- void Update()
- {
- //Press the space key to switch between render mode states
- if (Input.GetKeyDown(KeyCode.Space))
- {
- if (toggle)
- {
- vPlayer.renderMode = UnityEngine.Video.VideoRenderMode.CameraFarPlane;
- toggle = false;
- }
- else
- {
- vPlayer.renderMode = UnityEngine.Video.VideoRenderMode.APIOnly;
- toggle = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement