View difference between Paste ID: pAXUkCCE and AJZ0BySC
SHOW: | | - or go back to the newest paste.
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
}