コード例 #1
0
        /// <summary>
        /// Adds an array value to the property if it doesn't already exist
        /// </summary>
        /// <param name="ThisProperty">The property to add a value to</param>
        /// <param name="NewValue">The new value to be set. Must match the type returned by the property's
        /// PropertyType value</param>
        public static bool AddUniqueArrayValue(this SerializedProperty ThisProperty, System.Object NewValue)
        {
            if (!ThisProperty.isArray)
            {
                return(false);
            }

            int arrayIndex = ThisProperty.FindArrayIndexOf(NewValue);

            if (arrayIndex >= 0)
            {
                return(false);
            }

            return(ThisProperty.AddArrayValue(NewValue));
        }