how do you check for a Vector3 == null

hi , I'm pretty new to unity and Im having a few 'problems' converting my javascript code to unitycode. Ive seen that unity can check if a value is null or not (http://unity3d.com/support/documentation/ScriptReference/Object-operator_bool.html) but why can't Vector3 be checked for null with || like all other types ? Is there any short form for this or do I really have to write the if solution?

doesnt work:

var type:String;

var position:Vector3;

...

function (type:String,position:Vector3)

...

this.type = (type||"UNDEFINED");
this.position = (position||Vector3(0,0,0));

...

doesnt work either:

var type:String;

var position:Vector3;

...

function (type:String,position:Vector3)

...

this.type = (type||"UNDEFINED");
this.position = Vector3(0,0,0);
if (position) this.position = position;

...

really as:

var type:String;

var position:Vector3;

...

function (type:String,position:Vector3)

...

 this.type = (type||"UNDEFINED");
 this.position = Vector3(0,0,0);
 if (position==null) this.position = position;

...

Ent

A Vector3 is a struct and therefore can never be null. They start out as `Vector3(0, 0, 0)`. If you try to compare a struct to null (an object type), you will get compilation errors.

Since you're using Unityscript (which really isn't Javascript, but Unity's version of it), then this answer doesn't really apply. I'm posting it mainly for information.

However, in C#/.NET/Mono, it is possible to make some types Nullable. For instance, this code works (in C#):

void Start () {
Vector3? foo = null;
//foo = Vector3.zero; // would set non-null, but zeroed.
Vector3 bar = foo.Value; // foo is new type, have to get Value.
if (foo == null)
    Debug.Log("foo is null");
else
    Debug.Log("foo is non-null");
}

Note the Vector3? with a ?, which is what makes the type nullable.

Of course, if you write some of your scripts in JS, and some in C#, then you run into compilation-order issues, but it would work. Making a type Nullable also adds slightly more syntax, if you assign it to a standard type (you have to access the Value property).

Sorry but it cant be null, just make the co-ordinates 0,0,0 if you dont mind me asking, what were you trying to do?