FlowScriptController.SendEvent()

FlowCanvas Forums Support FlowScriptController.SendEvent()

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1901
    paradiddle
    Participant

    Hello,
    I can’t use FlowScriptController.SendEvent(“eventName”, obj) to pass my argument to the ‘CUSTOM EVENT’ node. The ‘Event Value’ output is always null. How can I correct this?

    My current workaround is adding a blackboard variable, and use it to store the argument temporarily by calling ‘flowScriptController.blackboard.SetValue()’. Then I can retrieve it’s value in the flow script.

    Thank you!

    #1908
    Gavalakis
    Keymaster

    Hello,

    The generic type of the CustomEvent node, has to be exactly the same as the type of the object send with the SendEvent method.
    Since I understand that this is not very convenient, I have changed the CustomEvent node, to also be able to work with assignable types. I have attached the changed node for you here for your convenience.

    Let me know if that works for you after importing the attached package.

    Thank you.

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

    Attachments:
    You must be logged in to view attached files.
    #1910
    paradiddle
    Participant

    Thank you, Gavalakis. I’ve also noticed this restriction, as it’s also true for ‘IBlackboard.SetValue(string varName, object value)’.
    It doesn’t help if I change the generic type of the CustomEvent node to the very specific subtype, and it’s still the same after importing the new script in you attachments.

    BTW, does FC support live editing (preserving all modifications made after exiting playmode)?
    Where does FC keep its prefered types library? The modified library seems not synchronized between my computers, and I use GIT to share files.

    #1911
    Gavalakis
    Keymaster

    Hey,

    Hmm. It is really weird that it does not work for you with the updated package I’ve attached for your in my previous post.
    I did check for example using a CustomEvent(UnityObject) node and from code use SendEvent<Transform>("myEvent", this.transform);, and it worked without any problems. Thus the fact that the value in your case is null, might be due to something else.
    Can you please provide more information on the exact node and code you use and and better yet a screenshot?

    Preferred Types list is stored within EditorPrefs, thus it’s local to the machine, but you can “Export” and “Import” the Preferred Types easily with the relevant buttons that exist on the Preferred Types window and commit that on git.

    Let me know.
    Thank you.

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

    #1914
    paradiddle
    Participant

    Hi, I found that when this ‘Custom Event’ is directly connected to a ‘Log Value’ node, I can get the ‘Event value’ output without a problem. But when it’s connected to a node which requires a downcast, that value becomes null. That means the automatic downcast failed.

    What’s the proper way of doing a type/class downcast manually in a flow script?

    Thank you!

    #1915
    Gavalakis
    Keymaster

    Hello again and sorry for the late reply (I was on a small vacation).

    Downcasts should really be handled automatically, but if not it must be a bug 🙁
    Can you please post a screenshot of your flowscript relevant nodes so that I can see more clearly what could possibly go wrong?

    With that said, if you want to make a custom cast, a new simple node will need to be added to FlowCanvas. To do so, please open up Utility.cs file and add this piece of code within the namespace (I will also include this node in the future version just in case).

    Let me know.
    Thanks!

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

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