Пример #1
0
        public static NullableBool ToNullableBool(this SerializedProperty sp)
        {
            var nullableBool = new NullableBool();

            if (sp != null)
            {
                nullableBool.hasValue = true;
                nullableBool.value    = sp.boolValue;
            }
            return(nullableBool);
        }
Пример #2
0
 public static void SetSerializedProperty(this SerializedProperty sp, NullableBool nullableBool)
 {
     if (sp == null || nullableBool.hasValue == false)
     {
         return;
     }
     if (sp.propertyType != SerializedPropertyType.Boolean)
     {
         return;
     }
     sp.serializedObject.Update();
     sp.boolValue = nullableBool.value;
     sp.serializedObject.ApplyModifiedProperties();
 }