Integration for odin inspector

YnS

New member
Hi,

I have been using both Behavior Designer and Odin inspector for some time and it is frustrating that Odin's attribute can not use in behavior designer's editor. If there is possible in the near future that I can use both of them at the same time?
 
You can create object drawers which integrate with Odin, but because this is such a low level feature and we cannot include Odin within Behavior Designer it's not possible to do a full fledged integration.
 
You can create object drawers which integrate with Odin, but because this is such a low level feature and we cannot include Odin within Behavior Designer it's not possible to do a full fledged integration.
Is it possible to create object drawers for action class? I tried so many times but every time but it just failed.
 
You can create object drawers which integrate with Odin, but because this is such a low level feature and we cannot include Odin within Behavior Designer it's not possible to do a full fledged integration.
I tried to create a custom editor for my action class like in unity editor. I failed to get the task variables using
serializedObject.Update() and could not create a foldout group based on the custom enum I created in my action class.
 
Is it possible to create object drawers for action class? I tried so many times but every time but it just failed.

Yes, those are just like any other tasks. The Stacked Action task is actually drawn using an object drawer.

Code:
    [CustomObjectDrawer(typeof(MyAction))]
    public class MyActionDrawer : ObjectDrawer
    {
        public override void OnGUI(GUIContent label)
        {
            var myAction = task as MyAction;

serializedObject.Update() and could not create a foldout group based on the custom enum I created in my action class.
Tasks are not serialized objects. There isn't a SerializedObject or SerializedProperty associated with them. You will need to use EditorGUILayout to draw the inspector elements.
 
  • Love
Reactions: YnS
Hi, I’m sorry to resurrect an old thread but, I looked at the solution and think I could create an attribute to draw fields with Odin using their property tree. However, I would need a callback for when the editor is opened and closed.

Currently, there is only the OnGUI method in ObjectDrawer. Would it be possible to add something like OnBeginGUI / OnEndGUI or similar? Or are there any alternative callbacks that are triggered when switching to the Inspector tab or when its content changes?
 
With IMGUI the inspector is updated every refresh so there are no change callbacks. For OnBeginGUI you could add a flag which gets set on the first OnGUI call, but there's no way to detect when the panel is no longer visible. Is there anything within Odin that would help with that?

Not sure if you're thinking of switching but when Behavior Designer Pro is released it'll be a lot easier to do this sort of thing since you can easily get callbacks like this from UIToolkit. There is an AttachToPanel and a DetachFromPanel event that you can listen for and there aren't any changes needed.
 
Hi, I’m sorry to resurrect an old thread but, I looked at the solution and think I could create an attribute to draw fields with Odin using their property tree. However, I would need a callback for when the editor is opened and closed.

Currently, there is only the OnGUI method in ObjectDrawer. Would it be possible to add something like OnBeginGUI / OnEndGUI or similar? Or are there any alternative callbacks that are triggered when switching to the Inspector tab or when its content changes?
Also another way to use custom drawer like Odin, now I link my Monobehaviors to behavior designer actions, for example: a custom action called "CustomAction" calling "MeleeAttack" Monobehavior in its OnUpdate function, so that I can use other package like Odin / Hot reload to modify the real action scripts without recompile.
 
Back
Top