mardi 3 septembre 2019

Getting an error when trying to use a one line if statement in Unity

I am getting an error when trying to use an one line if statement in Unity. I can't figure out what is wrong with it. Here is the line: MyImage.color == Color.white ? MyImage.color = Color.green : MyImage.color = Color.white;

I have it in the Update function. It's all that is in the update function. It says only assignment, call, increment, decrement, await, and new object expressions can be used as a statement. I am assigning a color to an image so I'm not sure what is wrong. This is unity 2018.3.0f3 if that matters.

Aucun commentaire:

Enregistrer un commentaire