Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: nickfourtimes on May 22, 2018, 04:53:12 PM

Title: [SOLVED] When do Bool Test events fire?
Post by: nickfourtimes on May 22, 2018, 04:53:12 PM
We've got a state that has many steps to it, and they all happen every frame. One of them is a ScreenToWorldPoint, and it stops with an error if one of the inputs is NaN (which makes sense).

We've made a custom IsNan test, which then passes a bool to BoolTest; if the BoolTest returns true (because IsNan is true), then it should fire an event leaving the state, and, we hope, avoiding the ScreenToWorldPoint, which would crash.

However, it seems like we're still crashing with the same error, that the test point is outside the camera frustum. In this case, even if the BoolTest wants to send the event, does PlayMaker still process every action in that state first, before firing the event and making the transition? Or should the event fire immediately, skipping the ScreenToWorldPoint bug? If the latter, that would mean we probably have some other logic problem in our FSM.
Title: Re: When do Bool Test events fire?
Post by: Kathar on May 22, 2018, 05:15:43 PM
I could be wrong, but my understanding is it should process the Actions in the State one at a time, in order, i.e. top-to-bottom. Similar to your situation, I always check if a GameObject is Null before I do anything with it that could throw up an error. For eg. so if if it is null, then it fires off a preemptive null/finished event, which prevents any errors occuring.
Title: Re: When do Bool Test events fire?
Post by: nickfourtimes on May 22, 2018, 05:20:11 PM
Yeah, that's what I was expecting, though I couldn't find anything confirming explicitly that behaviour (top-to-bottom, event-firing prevents running the states below). But if you're using it in your game then that does sound like it's behaving as expected.

As it turns out, the error was caused by a Unity bug, having to do with the Scene window and the faked "screen size" in the editor. Otherwise, our BoolTest and event are working as they should, so I'll mark this as solved for now. In any case, I wanted to confirm this behaviour, so, thanks!