22 lines
588 B
C#
Raw Normal View History

2021-04-25 00:59:37 +01:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
2021-04-25 05:16:35 +01:00
[ExecuteAlways]
2021-04-25 00:59:37 +01:00
public class GlitchInit : MonoBehaviour
{
private void OnEnable()
{
2021-04-25 05:16:35 +01:00
foreach (var glitchRenderer in GetComponentsInChildren<Renderer>())
2021-04-25 00:59:37 +01:00
{
var mpb = new MaterialPropertyBlock();
mpb.SetVector(
"_Positions",
new Vector4(Random.value,Random.value,Random.value,Random.value));
glitchRenderer.SetPropertyBlock(mpb);
}
}
}