Custom ReflectedFieldInspector types

Forums 💬 NodeCanvas ⚙️ Support Custom ReflectedFieldInspector types

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #17390
    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

      #17393
      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!

        #17392
        mrscary
        Participant

          Great.. perfect info.. Thanks!

          #17391
          Gavalakis
          Keymaster

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

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