playMaker

Author Topic: Performance : 'event' vs 'go to'  (Read 1886 times)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 773
Performance : 'event' vs 'go to'
« on: August 16, 2019, 10:47:58 AM »
Assuming you don't need to pass any data through an event, which one works faster in Playmaker, to communicate between different game objects or between two FSMs on the same object?
Send event or Go to actions?

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Performance : 'event' vs 'go to'
« Reply #1 on: August 16, 2019, 05:42:20 PM »
I have the feeling you worry about the wrong things  :) but I am curious to learn what you mean by "Go To" actions. What are they?

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Performance : 'event' vs 'go to'
« Reply #2 on: August 16, 2019, 06:38:42 PM »
Are you talking about the Goto State actions?

There shouldn't be much of a difference in performance i would think.

But seeing that the Event System is the backbone of unity, this should really be your default means of communicating between FSM's and GameObjects.

I don't really use Goto State between FSM's because it just seems more messy than Send Event, but that's just me.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Performance : 'event' vs 'go to'
« Reply #3 on: August 18, 2019, 08:46:11 AM »
Hi.
Go to state is perfectly fine to use and can be easier to use in some cases.
Performance should be on par (or so small of a difference that you would need 100.000 of these actions working at the same time to see a difference)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 773
Re: Performance : 'event' vs 'go to'
« Reply #4 on: August 18, 2019, 02:42:19 PM »
Okay, I was just being curious. I rarely use this goto action but it's an interesting way to drive a FSM to a specific point too without cluttering the events database.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Performance : 'event' vs 'go to'
« Reply #5 on: August 18, 2019, 04:48:09 PM »
Hi.
Just a extra :

With animation events you can use 'Set State' which seems to work better than send event.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Performance : 'event' vs 'go to'
« Reply #6 on: August 19, 2019, 02:26:37 AM »

But seeing that the Event System is the backbone of unity, this should really be your default means of communicating between FSM's and GameObjects.


The two event systems are totally different, so perfs are not linked.

Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Performance : 'event' vs 'go to'
« Reply #7 on: August 19, 2019, 02:28:35 AM »
Hi,

 Goto will probably have an edge in perfs because it's a direct order to go to a specific state.

But still, to got to that state, the algorythm has to iterate the list of states in the fsm, and to send and event is also iterating through the state and checking if it has this event as a global event to enter.

So in the end, go with what feels right for you, both are fine.

Bye,

 Jean