Making strings into variables in Java.

Hi in the below Java code, I want to be able to declare what the variables in the strings are, like how you do the following in C#

public void Red()
    {

        gameObject.GetComponent<Renderer>().material.color = Color.red;
}

//-------------------------------------- Distance 35- 25+
if (Distance <= 35 && Distance > 25 && !Once2) {
State = States[Random.Range(0,3)];
Move = Moves[Random.Range(0,3)];
Once1 = false;
Once2 = true;
Once3 = false;
}
//-------------------------------------- Distance 25-

}
}[/code]

  1. it’s javaSCRIPT… and really even that is a misnomer. It’s ‘unityscript’, a dialect based on that of javascript.

  2. that C# code doesn’t use strings for anything, so… I’m not sure what you’re attempting to emulate from that C# code.