Custom ObjectDrawer

Forums 💬 NodeCanvas ⚙️ Support Custom ObjectDrawer

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15724
    giane
    Participant

      Hello,

      I wanted to use Unity Localization package for the dialogue tree but I saw there are problems in the inspector for the ObjectDrawer with the LocalizedString property.

      I tried to create a custom drawer for the LocalizedString but I don’t understand how to create the default inspector for this property.

      #15727
      Gavalakis
      Keymaster

        Hello there,

        NodeCanvas has it’s own Object (and Attribute) drawers to use for everything that is inspected within the NodeCanvas inspectors. Please take a look at the documentation here on how to create custom Object and Attribute Drawers -> https://nodecanvas.paradoxnotion.com/documentation/?section=creating-custom-object-drawers

        If you have any questions or need any further clarifications regarding the above, please feel free to let me know 🙂
        Thanks!

        #15726
        giane
        Participant

          Yea, I saw the documentation and tried to create a custom ObjectDrawer for the LocalizedString but I never coded custom editors or attributes.

          My custom ObjectDrawer is working and all but I don’t know if there is a way on the “OnGUI override” to create a standard visualization of the existing LocalizedString class, in your examples you’re creating standard float or primitive attributes for structs and classes but there isn’t an example on how to draw a default class and if it’s possible.

          Thank you

          #15725
          Gavalakis
          Keymaster

            Hello,

            Drawers in NodeCanvas are different than Drawers used in Unity by default and as such it is not possible to draw a Unity made (with Unity API) drawer within the NodeCanvas drawers. As such, the class GUI will need to be coded in the NodeCanvas custom ObjectDrawer OnGUI. Within the ObjectDrawer OnGUI method you can use any Unity Editor API you’d like to create a custom GUI for the LocalisedString (or any other class you’d like). But once again, because the drawers in NodeCanvas and the drawers in Unity are different systems (they have to be vbecause they use a different serialization system), it is not possible to draw Unity-made drawers within NodeCanvas drawers.

            Please let me know if that clarifies your question.
            Thank you!

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