playMaker

Author Topic: [SOLVED] When do Bool Test events fire?  (Read 1207 times)

nickfourtimes

  • Playmaker Newbie
  • *
  • Posts: 27
[SOLVED] When do Bool Test events fire?
« 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.
« Last Edit: May 22, 2018, 05:20:56 PM by nickfourtimes »

Kathar

  • Playmaker Newbie
  • *
  • Posts: 48
Re: When do Bool Test events fire?
« Reply #1 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.

nickfourtimes

  • Playmaker Newbie
  • *
  • Posts: 27
Re: When do Bool Test events fire?
« Reply #2 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!