compairing a global variable

Hello everyone,
This might be a realy silly problem but still is a problem, i’m calling a global variable. which works perfectly. but at the point where if do this:

`if(somescript.somevar == "0") { 
///do stuff the var was 0
} else {
print("it wasn't 0 but it was "+somescript.somevar);
}
`

It is recieved but isn’t regonized for some weird reason, in the example ‘print’ above it does actualy show the 0 value. Why isn’t it regonized while comparing it?

Could it be you are comparing a numeric value with a string value so this condition will never evaluate to true.

try

if(somescript.somevar == 0) {...

Some more background information on this,

  1. At the start of the ‘game session’ i populated a static variable
    (static variable name = “”:wink:

  2. This variable was set at an object that doesn’t destroy on loading a new scene.

  3. I loaded a new scene (variables are still there)

  4. I called this populated variable from another script, works except it isn’t regonized through the equality (if(somescript.somevar == “0”))

i just tried to set my static variable (static variable name = “0”;)) without populating it, and this method was actualy regonized by equalizing it.

Hmm wags chin

anyone?