now suppose for example 2 + 3 = 6 (2,3,6 numbers are generated randomly…)i wil be using two GUIBUTTON one for right and other for wrong…now internally i should calculate answer for 2 + 3 = 5…and depending upon user pressing right or wrong button…if user presses wrong button for above example then my game should display next number…BUT MY POINT IS HW TO CALACULATE original answer internally…here is code…
#pragma strict
var rand:int;
function Start()
{
rand = Random.Range(0, 10);
}
function OnGUI()
{
//var rand:int;
//rand = Random.Range(0, 10);
//GUI.Label(Rect(20,20,100,30),rand.ToString());
GUI.Box (Rect (30,5,25,30), rand.ToString());//first random number
Debug.Log(rand);
GUI.Box (Rect (60,5,25,30),"+");//for +symbol
GUI.Box (Rect (120,5,25,30),"=");//for equals to
//var inter : int;
}