Custom ReflectedFieldInspector types

NodeCanvas Forums Support Custom ReflectedFieldInspector types

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13184
    mrscary
    Participant

    In prior versions, I would add my own types to EditorUtils.GenericField() as follows:

    What’s the proper way to do this versus hacking the editor code? Thanks

    #13189
    Gavalakis
    Keymaster

    Hello,

    To avoid hacking the source code, the proper way is to [Create Custom Object Drawers].
    Please take a look at the [Documentation for Creating Custom Object Drawers], but in short, you simply need to create a class like the following (remember that this is a Unity Editor only functionality, thus to wrap it into an #if UNITY_EDITOR define).

    ObjectDrawer class also has some important inherited properties that you might want to use:

    Thus, if in your case, you already have created GUI Editors for your classes (like for example ActionFlowField), you could do something like this:

    Or, you could move the code from your ActionFlowField method, into the OnGUI method of the ActionFlowFieldDrawer class, if it is only used within the context of NodeCanvas.

    Please let me know if that works for you.
    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #13202
    mrscary
    Participant

    Great.. perfect info.. Thanks!

    #13218
    Gavalakis
    Keymaster

    You are very welcome 🙂
    I am very glad it helps!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.