- changed status to resolved
Odin attributes not working in EditorGUILayout.PropertyField while others do
Issue #261
resolved
I'd like to use Odin attributes in combination with custom editors.
If I do something like the following in OnInspectorGUI, I notice that attributes like ToolTip work but the Odin attributes like AssetList or AssetsOnly do not.
EditorGUI.BeginChangeCheck();
SerializedProperty fieldProperty = serializedObject.FindProperty( "m_fieldName" );
EditorGUILayout.PropertyField( fieldProperty, true );
if( EditorGUI.EndChangeCheck() )
{
Undo.RecordObject( thing, "Did thing" );
EditorUtility.SetDirty( thing );
serializedObject.ApplyModifiedProperties();
}
The property is declared
[SerializeField]
[Sirenix.OdinInspector.AssetList(Path = "/Path/To/Stuff/")]
private Camera m_fieldName;
Unity: 2017.2 Windows 10 Odin: 1.0.5.3 (P.S. step 5 above should also mention that newer versions of the About are in "Tools > Odin Inspector > About" not "Window > Odin Inspector > About")
Comments (3)
-
-
And I fixed the about path - thanks for the heads-up! :)
-
reporter Much appreciated. I really did try to find an answer before posting but this one just slipped by me.
Cheers!
- Log in to comment
Odin uses a different drawing system than Unity's vanilla one - this is so we can draw data that is not serialized by Unity, which cannot be represented as a SerializedProperty.
It is however possible to write custom editor code using Odin - please refer to this FAQ answer for more details.