Created
August 8, 2017 23:32
-
-
Save unity3dcollege/d946c10d88e79d56221cfd5a7c834720 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 UnityEngine.UI; | |
public class ChooseRandomColor : MonoBehaviour | |
{ | |
public void ChangeImageColor() | |
{ | |
GetComponent<Image>().color = RandomColor(); | |
} | |
private Color RandomColor() | |
{ | |
return new Color( | |
UnityEngine.Random.Range(0f, 1f), | |
UnityEngine.Random.Range(0f, 1f), | |
UnityEngine.Random.Range(0f, 1f) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment