0
Not a Bug

Help; Custom event triggers only once

Mennovandijk 2 weeks ago updated 2 weeks ago 24

Hi,
I am having trouble triggering custom events after they have fired once.

I am triggering a custom event from the MathManager to a gameobject in the scene and sending 1 argument (an int value). The first time the value gets passed to the gameobject, but the secont time the event gets triggered, the event is not triggered on the gameobject. The 'old' value stays the same in that gameobject flow script. (you can see the event is not getting triggered)

I tried various work-a-round, and sometimes it works twice, but then the value stays the same again..

What could be wrong?
I can make a screenrecording to show you if my explanation is not clear.

Menno

Bolt Version:
1.4.8
Unity Version:
2019.2.10
Platform(s):
windows 10
Scripting Backend:
IL2CPP
.NET Version (API Compatibility Level):
.NET Standard 2.0

Hi Menno,

Sorry you're experiencing this issue.

Did this only start happening after upgrading to 1.4.8?

Probably yes, but it is hard to say exactly because I made huge progress today building the system. 
(made 3 of the 4 math elements today and the first one was working with 1.4.7)


I have made a small video showing what is (not) happening ;-)

Audio is pretty bad though.
http://dplusvisuals.nl/downloads/bolt_trigger_event.mp4

Ah ok, thank you for testing, is this something you will be able to fix in an upcoming update?

Looks like the issue was with my logic after all. Custom events with arguments fire fine in this test case: https://i.imgur.com/4dbPYS2.png

could it be because I am sending an event from a statemachine to another gameobject?

could it be because I am sending an event from a statemachine to another gameobject?

If you're trying to trigger a custom event on another object, you need to reference that object. 

I tested the same logic in a state machine that sends a custom event with float arguments to another object in it works just as fine as it did in the flow machine.

Hmm, I suddenly got this error without any changes to that part of the logic:

Do you have errors like this in the console?  

InvalidOperationException: The value of 'argument_0' on 'CustomEvent#2650f...' cannot be fetched dynamically, it must be assigned.
Bolt.Flow.GetValue (Bolt.ValueOutput output) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:535)
Bolt.Flow.GetValue (Bolt.ValueInput input) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:504)
Bolt.Flow.GetValue (Bolt.ValueInput input, System.Type type) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:567)
Bolt.Flow.GetValue[T] (Bolt.ValueInput input) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:572)
Bolt.Cooldown.Reset (Bolt.Flow flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Time/Cooldown.cs:191)
Bolt.Cooldown.Enter (Bolt.Flow flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Time/Cooldown.cs:177)
Bolt.Flow.InvokeDelegate (Bolt.ControlInput input) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:424)
Bolt.Flow.Invoke (Bolt.ControlOutput output) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:318)
Bolt.Flow.Run (Bolt.ControlOutput port) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:241)
Bolt.EventUnit`1[TArgs].Run (Bolt.Flow flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:157)
Bolt.EventUnit`1[TArgs].Trigger (Ludiq.GraphReference reference, TArgs args) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:128)
Bolt.EventUnit`1+<>c__DisplayClass14_0[TArgs].b__0 (TArgs args) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:69)
Bolt.EventBus.Trigger[TArgs] (Bolt.EventHook hook, TArgs args) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventBus.cs:72)
Bolt.EventMachine`2[TGraph,TMacro].TriggerRegisteredEvent[TArgs] (Bolt.EventHook hook, TArgs args) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:36)
Bolt.EventMachine`2[TGraph,TMacro].TriggerEvent (System.String name) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:14)
Bolt.EventMachine`2[TGraph,TMacro].Update () (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:75)

Here are 3 custom events with string and float arguments, all firing fine once I worked around that error. 

The gameobjects are in a list array, (as you can see in the video) I'll investigate further 

Hmm, I'm not seeing any videos. 

what if you put your setup into a statemachine? and then have the the logic go to another state and come back to this state? Does it still work?


I tried the same logic in a state machine, it sends a custom event with two float arguments to another object without any issues.

I have posted a link to a video I made (my 2nd post) 

I see the posts with a link to the video is "on moderation"


So I don't know if you have seen it.?

Nope, if it's on moderation, I can't see it. 

ok well, I copied the flow to a new statemachine and let it loop into itself and then it works, so I have to investigate why it doesn't work in the other statemachine graph.
I'll let you know if and why and how (i am sure I will) I solved it... 


+1

Ok, I got an update. It seems a user error off course ;-)
I disabled the gameobjects after picking and re-enabled them, somehow that causes the trigger not to work correctly. I have rearranged and adjusted some parts and finally I have something going :-)
Thank you so much for taking the time to see if there was a bug!!. (clearly not)
best regards
Menno

Need More Information

Glad you were able to get it fixed. :)

I'm not sure I follow, do you consider this to be a bug still? If so, please send me clear reproduction steps or a small example project so I can test on my end.

And I do apologize about the moderation filter, it's overly strict sometimes but we need it otherwise the forum gets riddled with ads and spam. I approved every of your post I saw.

Hi Lazio,
this doesn't seems to be bug. :-)
No need to apologize, your support is amazing! thank you!

best
Menno

Not a Bug

Ok, great, I'll close this issue then. :)

Cheers!