- Home /
Question by
Gabriel_Ris · Jun 19, 2017 at 03:28 PM ·
uieditor
How to update UI Text color in EditMode?
I'm using the following code to update an UI Text's color in EditMode:
public void Play()
{
timer = 0;
EditorApplication.update += EditorUpdate;
}
private void EditorUpdate()
{
timer += Time.deltaTime;
image.color = Color.Lerp(Color.black, Color.white, timer);
if(timer > 1)
EditorApplication.update = null;
}
The Play() function is called from a button of a Custom Editor and it works for sure. It seems like UI Color is not updated in Edit Mode. Any way to make it work?
Comment
I'm not sure for certain, but I think the editor window needs a call to redraw for the change to occur. SceneView.RepaintAll();
Or you need to update the Canvas (`Canvas.UpdateAllCanvases` or something)
Thank you for the comment, but unfortunately it didn't worked :(