Hi,
I want to change the color of a sprite on click -- to a random color from array.
When I click the sprite, the console message shows I'm getting a color from the array.
But I can't get the sprite to actually change color on-screen.
Does anyone know how to make this work properly?
Also I'm new to NGUI / coding in general so if there is an elegant solution to this problem please let me know.
Here is my code:
using UnityEngine;
using System.Collections;
public class btnUpdate2 : MonoBehaviour {
public Color[] squareColor;
public void onClickTweenColor () {
print ("example color from array: " + squareColor [Random.Range (0, squareColor.Length)]);
GameObject.Find ("WhiteSquare").GetComponent<UIWidget> ().color = squareColor [Random.Range (0, squareColor.Length)];
}
}