Hi. In my OnGUI funciton i am using a GUI.Button to move my character but i dont have to click on it and its mocing by himself... and also " Move " is written on the console every frame.I have been using this OnGUI function in other games and was working fine , i dont know what happend to unity but it is not working poperly.THANKS FOR THE HELP!
#pragma strict
public var skin : GUISkin;
public var player1 : GameObject;
function OnGUI()
{
GUI.skin = skin;
if ( GUI.Button ( Rect ( 0 , 0 , 100 , 100 ) , " " ) ) ;
{
player1.rigidbody2D.velocity = Vector2 ( 0 , 10 );
Debug.Log( " Move " ) ;
}
}
↧