i have a error for my random number script
it show “(9,12): UCE0001: ‘;’ expected. Insert a semicolon at the end.”
but i dont think there is a need to add a semicolon at that place, have i type anything wrong?
my script
import UnityEngine;
import System.Collections;
import java.util.Random;
function Update()
{
if(Input.touchCount == 1)
{
int q = Random.nextInt(5);
if(q == 0){i == 1;};
if(q == 1){i == 2;};
if(q == 2){i == 3;};
if(q == 3){i == 4;};
if(q == 4){i == 5;};
if(q == 5){i == 6;};
}
}
Agent_007:
Select a better topic when you create threads
Use code tags for code snippets
What should if(q == 0){i == 1;}; that do?
if q = 0, said 1 in game (i = text)
Is this sample code? It looks redundant: q is assigned a value. i is then assigned the value of q + 1.
Besides that:
The variable i isn’t declared anywhere.
i is being assigned a value using double equal signs.
int i = 0;
if (q == 0) { i = 1; }
Though it would be easier just to replace all that with:
int i = q + 1;
nburlock:
Is this sample code? It looks redundant: q is assigned a value. i is then assigned the value of q + 1.
Besides that:
The variable i isn’t declared anywhere.
i is being assigned a value using double equal signs.
int i = 0;
if (q == 0) { i = 1; }
Though it would be easier just to replace all that with:
int i = q + 1;
o thk, forget to set as variable