Property Drawer – Serialization Talk

FlowCanvas Forums Support Property Drawer – Serialization Talk

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3003
    heftycoder
    Participant

    Hello,

    I’ve come to notice that the graph does not use custom property drawers for variables / parameters etc. I’m guessing this is because of the custom serialization system. (If I’ve missed something and we can use those drawers, sorry for the trouble)

    Though it may not be crucial, I find custom drawers quite useful. As such, here are 2 ideas, one probably leading to a dead end and another that seems viable:

    1)  We can find the type / property connection by reflection and store it in a dictionary. The problem is that these drawers ask for a SerializedProperty in order for them to work. As of now, I do not believe this method is possible, unless we somehow manage to create a serialized property and connect it to our serialization system; Something that I believe is not possible (or at the very least is too hard to do)

    2) As of Unity 2019.3 (and above), Unity has the [SerializeReference] attribute. As long as you’re able to recognize what type you want to create, then simply having a data member of type <object>, setting that boxed type to a serializable value will make that value serialized and draw-able by the drawer. That means, though, that you have to depend on Unity’s serialization.

    I have not yet checked if custom drawers work with custom nodes (written in code). I’ll be sure to check that out and update this. All this has resulted in my attempt to use Flow Canvas to create a node-system for an extension I’ve made to Unity’s Timeline, which I want my designers / artistst to use without me necessarily. (We’re using Timeline as a dynamic builder instead of a static one).

    Sorry for the long post, thanks for sticking ’till the end!

    #3006
    Gavalakis
    Keymaster

    Hello there,

    Unfortunately, Unity’s Drawers do not work within FlowCanvas (either nodes or variables). That is because Unity drawers are very coupled with it’s own serialization system, whereas FlowCanvas is using a custom serializer. This is why FC also comes with its own custom drawers (both property and object drawers). These work similar to Unity drawers, but it is a different system. This will require re-implementing the drawer, but unfortunately making FC work out of the box with Unity native drawer was far from possible the last time I tried without a plethora of ugly hacks.

    Please take a look here for how custom property and object drawers work -> https://nodecanvas.paradoxnotion.com/documentation/?section=creating-custom-object-drawers (it’s on the NodeCanvas documentation, but they are exactly the same since both NC and FC share the same framework).

    Please let me know if the above help or work for you.

    Thanks!

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

    #3007
    heftycoder
    Participant

    Nice, I thought I couldn’t make custom drawers. It’ll be more work, but at least it can be done!

    Thanks!

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