24 lines
665 B
C#
24 lines
665 B
C#
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);
|
|
}
|
|
}
|
|
}
|