Unity3d Mono (Mono 2.6.5, Unity3d 4.1.2f1, OSX).
, ValueType, int != 0, (bool)true .. , , (int)0 (bool)false .
:
using UnityEngine;
using System.Collections;
public class Foo1 {
public bool Bar=false;
}
public class Foo2 {
public bool Bar=true;
}
public class Foo1i {
public int Bar=0;
}
public class Foo2i {
public int Bar=42;
}
public class PropTest:MonoBehaviour {
void Start() {
PassInFoo(new Foo1 {Bar=true});
PassInFoo(new Foo2 {Bar=false});
PassInFoo(new Foo1i {Bar=42});
PassInFoo(new Foo2i {Bar=0});
PassInFoo(new Foo2i {Bar=13});
}
void PassInFoo(Foo1 f) {Debug.Log("FOO1: "+f.Bar);}
void PassInFoo(Foo2 f) {Debug.Log("FOO2: "+f.Bar);}
void PassInFoo(Foo1i f) {Debug.Log("FOO1i: "+f.Bar);}
void PassInFoo(Foo2i f) {Debug.Log("FOO2i: "+f.Bar);}
}
un-unity3d OSX Mono 2.10.11 (mono-2-10/2baeee2 Wed Jan 16 16:40:16 EST 2013) :
FOO1: True
FOO2: False
FOO1i: 42
FOO2i: 0
FOO2i: 13
: : bugtracker: https://fogbugz.unity3d.com/default.asp?548851_3gh8hi55oum1btda