Advertisement
Guest User

SetInteractiveShaderEffects.cs

a guest
Jan 25th, 2019
5,176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class SetInteractiveShaderEffects : MonoBehaviour
  6. {
  7.     [SerializeField]
  8.     RenderTexture rt;
  9.     [SerializeField]
  10.     Transform target;
  11.     // Start is called before the first frame update
  12.     void Awake()
  13.     {
  14.         Shader.SetGlobalTexture("_GlobalEffectRT", rt);
  15.         Shader.SetGlobalFloat("_OrthographicCamSize", GetComponent<Camera>().orthographicSize);
  16.     }
  17.  
  18.     private void Update()
  19.     {
  20.         transform.position = new Vector3(target.transform.position.x, transform.position.y, target.transform.position.z);
  21.         Shader.SetGlobalVector("_Position", transform.position);
  22.     }
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement