talemon

Material instancing test

Mar 25th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.32 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class MaterialTest : MonoBehaviour
  4. {
  5.     private Material _mat;
  6.  
  7.     void Start()
  8.     {
  9.         _mat = GetComponent<Renderer>().material;
  10.     }
  11.    
  12.     void Update()
  13.     {
  14.         var col = _mat.color;
  15.         col.r = Mathf.PingPong(Time.time, 1f);
  16.         _mat.color = col;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment