Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class FakeRenderTexture : MonoBehaviour {
- public Texture2D texture;
- public float updateFrequency = .5f;
- private float lastUpdate = 0f;
- private Rect sourceRect;
- void Start() {
- sourceRect = new Rect (0, 0, texture.width, texture.height);
- camera.pixelRect = sourceRect;
- }
- void OnPostRender() {
- if (Time.time > lastUpdate + updateFrequency) {
- lastUpdate = Time.time;
- texture.ReadPixels (sourceRect, 0, 0);
- texture.Apply ();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement