Problem: (jump) will not read at times in windows standalone
Version: Unity 2.6.1
This is funny considering the jump works pre-build and even in the web player. Thus, the only reason is left to exporting to the windows standalone. Here is my code.
var jumpSpeed = 5.0;
var speed = 5;
private var state = 0;
private var grounded = false;
// This part detects whether or not the object is grounded and stores it in a variable
function OnCollisionEnter ()
{
state ++;
if(state > 0)
{
grounded = true;
}
}
function OnCollisionExit ()
{
state --;
if(state < 1)
{
grounded = false;
state = 0;
}
}
function FixedUpdate () {
if(Input.GetButton (“RollForward”)){
speed = speed + 1;
rigidbody.AddForce (0, 0, speed);
if (speed >= 6)
speed = 6;
}
if(Input.GetButton (“RollBackward”)){
speed = speed + 1;
rigidbody.AddForce (0, 0, -(speed));
if (speed >= 6)
speed = 6;
}
if(Input.GetButton (“RollLeft”)){
speed = speed + 1;
rigidbody.AddForce (-(speed), 0, 0);
if (speed >= 6)
speed = 6;
}
if(Input.GetButton (“RollRight”)){
speed = speed + 1;
rigidbody.AddForce (speed, 0, 0);
if (speed >= 6)
speed = 6;
}
if(Input.GetButton (“Boost”)){
rigidbody.AddForce(0,0,0);
}
if (grounded == true)
{
if(Input.GetButtonDown(“Jump”))
{
rigidbody.velocity.y = jumpSpeed;
}
}
}