Hello, im newbie programming and scripting, please can somebody help me?
when i build the script, sends me an error message who says: "Expressions in statements must only be executed for their side-effects’’ but i dont see it, can anybody tells me what im doing wrong?
#pragma strict
var moveUp : KeyCode;
var moveDown : KeyCode;
var speed : float = 10;
function Update ()
{
if(Input.GetKey(moveUp))
{
rigidbody2D.velocity.y - speed; // ← There is the problem, but where?
}
else if(Input.GetKey(moveDown))
{
rigidbody2D.velocity.y = speed *-1;
}
else
{
rigidbody2D.velocity.y = 0;
}
}
Anyway Thanks for the support!