Exemple #1
0
        private void Initialize()
        {
            BindableEvents = new BindableEvents(this);

            var type = typeof(T);

            if (type == typeof(String))
            {
                //                UnityEngine.Debug.Log("Setting value to string for " + GetType().Name + " is it null: " + (this == null));
                Value = (T)(object)"";
            }
            else if (type.IsPrimitive)
            {
                //                UnityEngine.Debug.Log("Setting value to default for " + GetType().Name + " is it null: " + (this == null));
                Value = default(T);
            }
            else
            {
                //                UnityEngine.Debug.Log("Setting value of type " + type.Name + " to this for " + GetType().Name + " is it null: " + (this == null));

                // explicitly convert the type because pure cast is not enough
                Value = default(T);
            }
        }
Exemple #2
0
 private void Initialize()
 {
     BindableEvents = new BindableEvents(this);
 }