IRCSS

Auto Colorize

Feb 6th, 2019
161
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. [ExecuteInEditMode]
  6. public class Colorize : MonoBehaviour {
  7.     public Color color;
  8.  
  9.     void Start()
  10.     {
  11. #if UNITY_EDITOR
  12.         this.GetComponent<Renderer>().material.SetColor("_Color", color);
  13. #endif
  14.     }
  15.  
  16.     void Update()
  17.     {
  18. #if UNITY_EDITOR
  19.         this.GetComponent<Renderer>().sharedMaterial.SetColor("_Color", color);
  20. #endif
  21.     }
  22.  
  23.  
  24. }
RAW Paste Data