Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- [ExecuteInEditMode]
- public class ChangeColor : MonoBehaviour {
- public Color NewColor = new Color(0, 0, 0);
- public bool DoUpdate = true;
- void DoColorUpdate()
- {
- MeshRenderer rend = GetComponent<MeshRenderer>();
- rend.material.SetColor("_Color", NewColor);
- }
- void Update () {
- if (DoUpdate)
- {
- DoColorUpdate();
- DoUpdate = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment