/OdinTree

Primary LanguageC#MIT LicenseMIT

OdinTree

This attribute will make it easier when you need to create custom fields and windows within the NodeCanvas, as this attribute will draws objects using the Property Tree in conjunction with the Attribute Drawer.

Requires Odin Inspector and NodeCanvas.

Installation

Simply put the OdinTreeAttributeDrawer.cs file inside an Editor folder and the OdinTreeAttribute.cs in a shared folder, and start using the attribute as shown in the example.

Example

First you create a serialized class using the attribute [System.Serializeble]. Within this class you can use any attribute, including other assets such as [FMODUnity.EventRef].

[System.Serializable]
public class DialogueConfig {

    [TextArea]
    public string text = "This is a dialogue text";

    [ColorPalette("ActorsColors")]
    public Color color;

    public PlayableAsset playable;
    
    [FMODUnity.EventRef]
    public string sound;
}

And then just declare your class using the [OdinTree] attribute inside a NodeCanvas class, for example using the ActionTask.

public class Speak : ActionTask {
    [OdinTree] public DialogueConfig dialogueConfig;
}

Preview: image