1234567891011121314151617181920212223242526272829 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class RenderTextureControl : MonoBehaviour {
- Camera cam;
- void Awake ()
- {
- cam = GetComponent<Camera>();
- }
- IEnumerator RenderOneFrameToTexture()
- {
- yield return new WaitForEndOfFrame();
- cam.enabled = false;
- }
- void OnEnable()
- {
- StartCoroutine(RenderOneFrameToTexture());
- }
- void OnDisable()
- {
- cam.enabled = true;
- }
- }
|