- Home /
Question by
thunderbuns · Jan 18, 2018 at 08:07 PM ·
c#scripting problemcolors
[HELP] CanvasRenderer.GetColor not working
I am trying to use CanvasRenderer.GetColor but every time I give it a parameter it says "No overload for method 'GetColor' takes '1' arguments" and when I try give it no parameters I get "Cannot implicitly convert type 'UnityEngine.Color' to 'string'" and "An object is required to access non-static member 'UnityEngine.CanvasRenderer.GetColor()'". I feel that the answer to this question is very simple but the documentation is crap. Here is my code
GameObject go = GameObject.Find("Go");
GameObject wait = GameObject.Find("Wait");
Color green = new Color(98, 244, 66);
Color red = new Color(244, 65, 65);
void Start() {
//this code is called after the fake pointer goes through a sequence
Debug.Log("Its alive");
toggleColor();
}
void toggleColor() {
string currentColor = CanvasRenderer.GetColor();
Debug.Log(currentColor);
go.GetComponent<CanvasRenderer>().SetColor(red);
wait.GetComponent<CanvasRenderer>().SetColor(green);
}
Comment