Library/PackageCache/com.unity.quicksearch@1.6.0-preview.8/Editor/Indexing/ObjectIndexer.cs
/// <summary>
/// Get the property value of a specific property. This will converts the property to either a double or a string.
/// </summary>
/// <param name="property">Property to get value from.</param>
/// <param name="saveKeyword">If set to true, this means we need to save the property name in the index.</param>
/// <returns>Property value as a double or a string or null if we weren't able to convert it.</returns>
Get the property value of a specific property. This will converts the property to either a double or a string.
Get the property value of a specific property . This will converts the property to either a double or a string .
protected object GetPropertyValue(SerializedProperty property, ref bool saveKeyword)
        {
            object fieldValue = null;
            switch (property.propertyType)
            {
                case SerializedPropertyType.Integer:
                    fieldValue = (double)property.intValue;
                    break;
                case SerializedPropertyType.Boolean:
                    fieldValue = property.boolValue.ToString();
                    break;
                case SerializedPropertyType.Float:
                    fieldValue = (double)property.floatValue;
                    break;
                case SerializedPropertyType.String:
                    if (property.stringValue != null && property.stringValue.Length < 10)
                        fieldValue = property.stringValue.Replace(" ", "").ToString();
                    break;
                case SerializedPropertyType.Enum:
                    if (property.enumValueIndex >= 0 && property.type == "Enum")
                        fieldValue = property.enumNames[property.enumValueIndex].ToString();
                    break;
                case SerializedPropertyType.ObjectReference:
                    if (property.objectReferenceValue)
                    {
                        saveKeyword = false;
                        fieldValue = property.objectReferenceValue.name.Replace(" ", "");
                    }
                    break;
                default:
                    break;
            }
            return fieldValue;
        }
protected object GetPropertyValue ( SerializedProperty property , ref bool saveKeyword ) { object fieldValue = null ; switch ( property . propertyType ) { case SerializedPropertyType . Integer : fieldValue = ( double ) property . intValue ; break ; case SerializedPropertyType . Boolean : fieldValue = property . boolValue . ToString ( ) ; break ; case SerializedPropertyType . Float : fieldValue = ( double ) property . floatValue ; break ; case SerializedPropertyType . String : if ( property . stringValue != null && property . stringValue . Length < 10 ) fieldValue = property . stringValue . Replace ( " " , " " ) . ToString ( ) ; break ; case SerializedPropertyType . Enum : if ( property . enumValueIndex >= 0 && property . type == " " ) fieldValue = property . enumNames [ property . enumValueIndex ] . ToString ( ) ; break ; case SerializedPropertyType . ObjectReference : if ( property . objectReferenceValue ) { saveKeyword = false ; fieldValue = property . objectReferenceValue . name . Replace ( " " , " " ) ; } break ; default : break ; } return fieldValue ; }
Get the property value of a specific property.
Get the property value of a specific property .
Property value as a double or a string or null if we weren't able to convert it.
Property value as a double or a string or null if we weren ' t able to convert it .
property
SerializedProperty
Property to get value from.
Property to get value from .
bool
ref
saveKeyword
If set to true, this means we need to save the property name in the index.
If set to true this means we need to save the property name in the index .