Created
February 18, 2022 11:03
-
-
Save partiallyblind/c796dda180b741cf5c38741f2281e3a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TurnColorScript : MonoBehaviour | |
{ | |
void OnEnable() | |
{ | |
EventManager.OnClicked += TurnColor; | |
} | |
void OnDisable() | |
{ | |
EventManager.OnClicked -= TurnColor; | |
} | |
void TurnColor() | |
{ | |
Color col = new Color(Random.value, Random.value, Random.value); | |
renderer.material.color = col; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment