Esempio n. 1
0
        public static NullableInt ToNullableInt(this SerializedProperty sp)
        {
            var nullableInt = new NullableInt();

            if (sp != null)
            {
                nullableInt.hasValue = true;
                nullableInt.value    = sp.intValue;
            }
            return(nullableInt);
        }
Esempio n. 2
0
 public static void SetSerializedProperty(this SerializedProperty sp, NullableInt nullableInt)
 {
     if (sp == null || nullableInt.hasValue == false)
     {
         return;
     }
     if (sp.propertyType != SerializedPropertyType.Integer)
     {
         return;
     }
     sp.serializedObject.Update();
     sp.intValue = nullableInt.value;
     sp.serializedObject.ApplyModifiedProperties();
 }