Hi
how do I test if an array element is true/exists?
In Javascript you can simply have:
if (ArrayElement) {continue}
how is this done in JScript/Unity?
thanks
Hi
how do I test if an array element is true/exists?
In Javascript you can simply have:
if (ArrayElement) {continue}
how is this done in JScript/Unity?
thanks
Have you tried asking if its null or true or false in the condition? ![]()
Bump!
Can anyone please help me?
I am still having trouble with this:
if (Array[×][y]!=undefined) {
Debug.Log(“Array element exists”);
}
if (Array[×][y]= true) {
Debug.Log(“Array element exists”);
}
none of these work.
The same way.
var obs : Array = AllObjectsInScene(); // magic function that doesn't really exist
DestroyRandomObjects( obs ) // again, not exists.
for ( var ob : GameObject in obs ) {
if ( ob ) {
Debug.Log( ob.name + " still exists." );
}
}
Also, instead of “if x=true”, you need “if x == true.” “=” is assignment and (usually) returns true.