- changed status to open
Attributes don't work in ScriptableObject edtor
I have a project in Unity 2018.2.0f2. Here is my scriptable object:
using System.Collections.Generic;
using UnityEngine;
using Sirenix.OdinInspector;
[CreateAssetMenu]
public class GameEvent : ScriptableObject
{
[ReadOnly]
public string Description;
And this is how my Object looks in the editor: http://take.ms/M1u4j I have also tried some other attributes and they also don't work.
However in monobehaviour object [ReadOnly] attribute works fine.
Comments (5)
-
-
reporter Just checked there and this is what I see: http://take.ms/4Exqd
GameEvent type does not have a checkbox, is there something I did wrong?
-
- changed status to invalid
There is an editor called GameEventEditor already drawing GameEvent - therefore, Odin is not drawing it, and you are not getting the benefits of Odin. You can derive from OdinEditor instead of Editor in the GameEventEditor class, and manually use Odin's utilities via the PropertyTree (base.Tree) to do the drawing.
However, the recommended approach with Odin is to never make your own custom editor. If you want that Raise button, for example, simply make a Raise() method and put [Button] on it. You should never have cause to create a custom editor class when using Odin. However, if you do that, then you need to use Odin manually.
-
reporter WOW!!! Thanks a lot, it worked, this is a very detailed and personal approach! A tech support on an extremely high level!!!
-
- changed version to 2.0.0.0 (formerly 1.1)
- Log in to comment
Have you confirmed in Tools -> Odin Inspector -> Preferences -> Editor Types that Odin is actually drawing the scriptable object in question?