FlowCanvas Forums › Support › Custom Event possibly not working? (Tooltip inconsistency adds confusion)
I have a scripted event that is correctly showing via a debug log that it’s working, however the custom event isn’t triggering in the FlowScriptController.
I’m not sure if there’s something I’m doing wrong, as the tooltip in the custom event (couldn’t find any details separately in the documentation) says to use ‘FlowScriptController.SendEvent(string)’ however the code I’m using, based on the visualstudio autocomplete is ‘gameObject.GetComponent<FlowScriptController>().SendEvent(“test”)’.
Anything else wants me to use ‘FlowScriptController.SendGlobalEvent(“test”)’ instead, which also doesn’t work.
This is a screenshot of my node setup – https://i.gyazo.com/4e2a1ab33a2defda44c6a88e48d7f726.png
And the full code I have my event being called from –
1 2 3 4 5 6 7 8 9 10 11 |
using UnityEngine; using FlowCanvas; public class BoltAttached : Bolt.EntityBehaviour<ICubeState> { public override void Attached() { string test = "test"; gameObject.GetComponent<FlowScriptController>().SendEvent(test); FlowScriptController.SendGlobalEvent(test); Debug.Log("Does this work?"); } } |
I’d really appreciate knowing if I’m missing something here/if I’ve setup something incorrectly and how I might fix it.
Hello again,
If this script posted above is attached on the same gameobject as the FlowScriptController that you are sending the event is, then it should really work. I think it already does, but the thing that probably made up for the confusion is the fact that your color ALPHA in the Set Color node is 0 (full transparent). Could this be the case?
Also, have you tried with a simple Debug Text or Debug Value node just to make sure it does or does not work?
Let me know.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Thanks for the response but that’s not the issue. If I set the color via update etc it works perfectly, that was the first thing I made sure of.
EDIT:
Very weird, I discovered that the global event is being properly sent to the cube in the client version (only the one it is attached to), and on the listen server, however the original cube instantiated on the listen server doesn’t work at all.
The specific object event still works for neither.
Which doesn’t make sense to me because the test log is functioning properly for both?
Edit 2:
It’s not actually being ‘properly’ sent. When I join with the second cube, on the client it send the global event to itself, but on the server side that login causes the original cube to change color-rather than the new one? Very confusing, might be a result of it being global though, or something? As the object call doesn’t work at all.
Edit3:
I’m wondering if this is related to an error received after I stop the project,
“NullReferenceException: Object reference not set to an instance of an object
ParadoxNotion.Services.MessageRouter.UnRegister (System.Object target, System.String[] messages) (at Assets/ParadoxNotion/FlowCanvas/Framework/_Commons/Runtime/Services/MessageRouter.cs:247)”
-I just removed the script with that is sending the custom event and this error disappeared so it must be related in some way, though I don’t know enough to understand if it’s just miscellaneous errors on stopping the graph rather than directly related to attempted messages.
Sorry for double posting, however I just wanted to re-iterate in-case the edits above hadn’t been seen, that I’ve still found no solution for sending an event correctly and would greatly appreciate it the above can be looked over in-case I’m missing something or there may be miscellaneous bug in the system.
Hey,
Sorry for the late reply.
Indeed I missed the edits, so it’s great that you re-posted. No problem at all!
The thing is that networking is quite difficult, has a lot of caveats and I have absolutely no idea how Bolt works, like what is synced, or how it’s synced. It’s very difficult for me to come up with what could potentially be wrong without taking a closer look at the project.
If you can, please send me the project (or any similar reproduction case) to support_AT_paradoxnotion.com and I will take a look to see what could be wrong and whether or not it’s possible to do using Bolt + FlowCanvas.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
No worries, glad I thought to double check and thanks for your response/understanding regarding that.
Just working on a reproducible scene for you now, and wanted to mention an initial discovery.
3 cubes, CubeA/CubeB/CubeC all in the same scene, without instantiating/etc, have a custom event sent from CubeA’s graph on awake.
Only CubeB receives that event.
To have them all receive it, I had to add a 1 second wait before running the event.
So, even CubeA, where the event is sent from, can’t receive it correctly without the delay,
and for some reason CubeB *consistently* is the only one to be able to receive it?
These are nothing but copy/pasted cubes.
https://i.gyazo.com/722697d8ca30cbb2e32db50a82c4498c.png
Hello again,
I think I now understand the problem. That is that when an event is send from the Awake of one flowscript, other flowscripts might not have already be initialized. That is because Awake event is send immediately after the flowscript is started.
I will take a look and fix this as soon as possible.
Thanks a lot for your information up to now and for your understanding!
Join us on Discord: https://discord.gg/97q2Rjh
Ahh yeah, that’d make sense.
No worries, thanks a lot for your responses and perseverance to improve your awesome asset 🙂 goodluck finding a solution.
Just wanted to re-iterate after attempting to make more progress that this is still a significant issue I’m finding in multiple areas.
For example the ‘mouse’ action that lets you automatically have reactions based on interactions with an objects collider can also fail, as it seems it’s not able to register the collider as its target before the event is activated/the mouse action becomes active.
(This happened to 3 of 8 objects in a scene that all shared the same flow script asset).
As a result I had to setup a cumbersome workaround to deactivate/re-activate the objects after the scene starts in an attempt to properly register the mouses target that delays the speed players can make actions and I really hope I don’t need to permanently keep trying to find these workarounds that negatively affect the play experience.
Hey,
Thanks for extra input. I am really close to finding a solution to the order of registration of events when multiple flowscripts are used and thus avoid this issue you are facing. Hopefully the fix for that will be there in the next version coming around soon.
Thanks again.
Join us on Discord: https://discord.gg/97q2Rjh
That’s seriously the best news, thanks so much for working hard to resolve that, it’ll be awesome not having to worry about that.
Goodluck on wrapping up a solution, I can’t wait for the update :)!!