[NodeCanvas] Unable to serialize private field

NodeCanvas Forums Support [NodeCanvas] Unable to serialize private field

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16269
    dominatorduck
    Participant

    I’m attempting to serialize a private field as shown in 1, but NodeCanvas is failing to serialize the field as shown in 2. 3 Shows Unity serializing the field in a ScriptableObject.
    InkedHowToSerializePvtField_LI

    Here you can see the value as serialized in the graph asset file:
    image_2022-06-08_211119396

    I’m using Unity 2020.1.6f1 and NodeCanvas 3.2.2.
    Do I have to create a custom ObjectDrawer for this case?

    Attachments:
    You must be logged in to view attached files.
    #16285
    Gavalakis
    Keymaster

    Hello there,

    The inspectors in NodeCanvas do not expose private fields by default even if they are set as [Serializable]. While this is different than Unity inspectors, it always felt incorrect to expose private fields.

    With that said, you can simply add the [ParadoxNotion.Design.ExposeField] attribute on your private field to expose it in the NodeCanvas inspector (no custom object drawer required).

    Let me know if that works for you.

    Thanks!

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

    #16289
    dominatorduck
    Participant

    That definitelly works!

    Thanks Gavalakis!
    I’m loving NodeCanvas.

    #16304
    Gavalakis
    Keymaster

    I am very glad to hear that! Thank you! 🙂

    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.