How to detect end of async initialization

FlowCanvas Forums Support How to detect end of async initialization

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #3297
    edamiani
    Participant

    Hi, I have a problem related to async initialization. I’ve created a custom node that clones a GameObject and sends it as an output. Soon after that, I’m supposed to call an event on the cloned object. The problem is that, for performance reasons, I need to set the “First Activation” property of my FlowScript controllers to “Async” and, because of that, when the event is triggered, the cloned object hasn’t initialized yet and the event never reaches the target.

    I have included a screenshot showing the relationship between the custom node and the event node.

    Is there a way of detecting when the async initialization is finished so I can trigger the node’s output at the right time? (Clone Game Piece is a custom node that is already capable of delaying the outflow, I just need a way of registering a callback that will call it at the right time).

    Thanks in advance.

     

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

    Hello!

    There is a bool property called “initialized” in GraphOwner, which will be true only after initialized (both in async and not async). On the next version there will also be an even (which has been requested before) since it will be easier to use than checking the bool property.

    Let me know if that works for you. 🙂

    Thanks!

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

    #3303
    edamiani
    Participant

    Hi Gavalakis, thank you for your prompt reply. For some reason, checking the initialized property isn’t working, it seems to be something else. I’ll keep investigating to see if I can find more clues on it.

    #3304
    edamiani
    Participant

    Hi Gavalakis,

    I found something that might be useful. I’ve added some breakpoints inside FlowCanvas to check up to what point the flow was being executed. What I discovered is that the Send Event node is being triggered but, inside Graph.SendEvent(), router is set to null so router.InvokeCustomEvent() isn’t called. Maybe I’m doing something wrong here?

    Thanks in advance.

    Attachments:
    You must be logged in to view attached files.
    #3306
    edamiani
    Participant

    On a side note: Send Event works normally when I change “First Activation” from “Async” to “On Enable”

    #3314
    edamiani
    Participant

    Hi, sorry for bumping the thread, any insights on what might be causing it? We are getting closer to our first release date and this issue is causing performance problems that might become prohibitive on our side.

    #3320
    Gavalakis
    Keymaster

    Hello again and sorry for the late reply.

    Please try open up CustomEvent.cs file and add the [ExecutionPriority(100)] attribute on top of the CustomEvent class.

    Let me know if this works for you.

    Thanks!

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

    #3326
    edamiani
    Participant

    Hi Gavalakis,

    Thanks for your reply. I did the change you mentioned and now I’m getting a series of errors shown in the screenshot.

    Thanks in advance.

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

    Hello and sorry for the late reply.

    The change I suggested above shouldn’t have brought these issues (unless you already had these issues).

    It would help greatly if you can please send me a reproduction to support_AT_paradoxnotion.com to see what could be going wrong.

    Thank you!

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

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