revival/game/Assets/Scripts/Rendering/GlitchInit.cs

24 lines
665 B
C#
Raw Normal View History

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