Skip to content

Instantly share code, notes, and snippets.

@partiallyblind
Created February 18, 2022 11:03
Show Gist options
  • Save partiallyblind/c796dda180b741cf5c38741f2281e3a5 to your computer and use it in GitHub Desktop.
Save partiallyblind/c796dda180b741cf5c38741f2281e3a5 to your computer and use it in GitHub Desktop.
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