Creating New Events

FlowCanvas Forums Support Creating New Events

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #277
    nickcaligo42
    Participant

    Hey there,

    First off, let me say I’m really impressed with the quality and polish of both FlowCanvas and NodeCanvas. It’s saving me and my team a lot of headaches in the design tool useability department.

    Now onto business. I’m trying to code a custom event node for some puzzle trigger behaviors I’ve written in C#, meant to behave similarly to the TriggerEnter or CollisionEnter nodes. The code for the node itself thus far is pretty straightforward:

    However, the node is non-functional. I’ve created several events in the base puzzle trigger script that should be viable for registration, but I’m not sure what step I’m meant to take to insure that it registers to the message router. I notice that it has a lot of the base Unity events hard-coded into it like so:

    — but I’m unsure at what point these get added to the dictionary or how it knows to register the event provided through the PuzzleTrigger. Can you offer any insight into how to approach this?

    #279
    nickcaligo42
    Participant

    Figured it out! Really simple actually. The OnGraphStarted function can manually assign these to System.Action callbacks like so.

    #281
    Gavalakis
    Keymaster

    Hey,

    Thanks a lot! I’m glad you like the tools 🙂

    Since you you have c# events that you want to use, indeed the way you did it was the one to go. Alternatively you could also use the “Code Event” node which subscribes to a c# event through reflection, but of course having all 3 of those events together in one node like you did is a bit more nice.

    Just to clarify, regarding the MessageRouter and the way the included nodes work through the use of GetTargetEvents(), it is usefull when not working with c# events, but rather with messages send to the target gameobject instead. In this case, a method with the same name as the event name needs to be implemented in MessageRouter.cs, which is a partial class, thus no source code changes needed.
    But, in your case, what you did was the best approach anyway 🙂

    Cheers!

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

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