I have a line that of code that i use over and over several times in different ways
GameObject.Find("colorswitchred (" + id.ToString() + ")").transform.GetComponent<Main>().state
such as:
if (GameObject.Find("colorswitchred (" + id.ToString() + ")").transform.GetComponent<Main>().state < 3)
{
GameObject.Find("colorswitchred (" + id.ToString() + ")").transform.GetComponent<Main>().state ++;
}
else
{
GameObject.Find("colorswitchred (" + id.ToString() + ")").transform.GetComponent<Main>().state = 1;
}
Is there a way I can set a string or something to be this line of code, that way I can just do like
if (tile < 3)
{
tile ++;
}
else
{
tile = 1;
}