Question by
sneakyninja0129 · Feb 28, 2016 at 09:18 AM ·
javascriptcodepage
If statement is always true
#pragma strict
var MaxFallDistance = -110;
function Update ()
{
if(transform.position.y <= MaxFallDistance);
{
Debug.Log ("We good fam");
}
}
no matter where i am the if statement is always true even at 0, 0, 0. please help!!!
Comment
Answer by tanoshimi · Feb 28, 2016 at 09:21 AM
function Update () {
if(transform.position.y <= MaxFallDistance) {
Debug.Log ("We good fam");
}
}
Please format your code correctly
You have an erroneous ; after your if statement. It should be as above.
Answer by bubzy · Feb 28, 2016 at 09:21 AM
it isnt true you just made a syntax error
if(transform.position.y <= MaxFallDistance);
should be
if(transform.position.y <= MaxFallDistance)
:)
Your answer
Follow this Question
Related Questions
A code prob. (java) 0 Answers
Could I get some help updating this code to unity 5? 0 Answers
Infinite floor with object as terrain. 1 Answer
speed = transform.rotation * speed; explanation please? 1 Answer
How to enable a script in Play-Mode? 1 Answer