Forums › 💬 NodeCanvas › ⚙️ Support › Support for Unity [SerializeField]
Hi, recently updated Node Canvas and found that [SerializeField] is no longer supported for Action Tasks. Is it intentional behavior, or should I roll back and wait for the fix? Also, my custom attributes and attribute drawers are not supported as well (again, not sure if intentional). Would appreciate some information in this regard, thanks.
Hello there,
Can you please clarify what part of [SerializeField] is not working? Using the [SerializeField] will make a private field be serialized (public fields are always serialized anyway). Using [SerializeField] will not expose private fields in the inspector if that is the issue you are having (?). To do so please use [ExposeField] (or simply make the field public of course 🙂 )
Regarding the custom attribute and attribute drawers, custom attribute and drawers made on the Unity system were never supported because NodeCanvas uses a different serialization system than Unity and these things are technicaly bound together. NodeCanvas only supports custom attribute and drawers made with the custom attribute/drawers system ( https://nodecanvas.paradoxnotion.com/documentation/?section=creating-custom-object-drawers ). Do you mean you have issues with custom attribute/drawers you’ve made with this system, and if so can you please clarify what issues?
Thanks.
Hello.
[SerializeField] is not exposing the private string variable in the node window, it was the case previously (I haven’t updated the package for quite some time) so kind of got off guard. Same with the attribute drawer. I’ll implement the new one using this system and ping you here again if I have any issues.
Thanks a lot for helping me out with this.
Hello!
Have another issue with the Node Canvas inspector. In the earlier version, there was support for the Odin Inspector (or at the very least, Odin attributes worked). It doesn’t seem to be the case anymore, in particular, the [ShowInInspector] attribute. Are you planning to support Odin in the future? And is there a relatively straightforward way to implement a custom Node inspector that would support all the attributes that I need?
Hello again!
Hmm… there was never support for Odin Inspector in NodeCanvas to be honest 🙂 NodeCanvas only ever supported its own custom made attributes for inspectors. What does a [ShowInInspector] attribute does in Odin please? (I can implement that for you in NodeCanvas and send it to you if you want).
If you want to take full control of a specific node or task inspector without relying on implementing attributes drawers, you can overriding the protected void OnNodeInspectorGUI for nodes (or OnTaskInspectorGUI for tasks) and create a custom inspector for that node/task in there.
Out of curiocity, what was the previous NodeCanvas version that you were using?
Thanks 🙂
Thanks for the reply.
Just clarify, by ‘support’ I mean things worked. [ShowInInspector] attribute shows but does not necessarily serialize the marked field in the inspector (https://odininspector.com/documentation/sirenix.odininspector.showininspectorattribute).
For the project I’m working on specifically, it allowed me to pick and choose a concrete type that implemented a certain interface, and then my custom attributes provided a drop-down list for certain fields in the concrete types that would pull the actual values from the scriptable object. Very handy. I was able to re-implement attributes in a way suitable for Node Canvas, but it only solves one small issue for me. If I could somehow create a custom node inspector that would support Odin – it would solve all my issues in one go basically (Odin will provide support for my custom attributes as well).
Sorry for the wall of text, hope this makes sense.
