unity Default Vector3 compile-time constant
myFunction(Vector3? inputVector3 = null){
//Vector3? is a nullable Vector3 type
if(inputVector3 == null){
usedVector3 = Vector3.zero;
//so if our input value is null
//we set the Vector3 we want to use in script
//equal to zero
}else{
usedVector3 = (Vector3)inputVector3;
//but if the user inputs a value
//all we have to do is set the Vector3
//we're using for our script equal to
//a "Casted" value of our input value
}
}
//Credit: Chris Sinclair
Vector3? myVector = null;
if (myVector.HasValue)
{
Vector3 myNonNullVector = myVector.Value;
}