Playmaker Forum

PlayMaker Help & Tips => PlayMaker Tips & Tricks => Topic started by: DennisJensen on July 21, 2014, 10:30:31 AM

Title: Performance in Playmaker (Trigger event, Every Frame, Changed etc)
Post by: DennisJensen on July 21, 2014, 10:30:31 AM
Hi Forum,

So as a newbie, I could love some facts/tips on how much different actions are influencing performance.

Every Frame:
I know it's okay to use, but maybe not all the time. Instead of checking every frame I could use "changed float", but I'm not sure if it's better performance wise?

Trigger event:
How often does it check? is it like everyframe or does it only check when the rigid body moves?

Other tips on what takes more performance and a alternative would be really cool.
 
Title: Re: Performance in Playmaker (Trigger event, Every Frame, Changed etc)
Post by: jess84 on July 21, 2014, 11:05:33 PM
Do not under any circumstance use OnTriggerStay.

And try and avoid using Unity GUI elements.
Title: Re: Performance in Playmaker (Trigger event, Every Frame, Changed etc)
Post by: 600 on July 22, 2014, 03:03:01 AM
Hello,

- About every frame actions vs "changed", I understand they all are every frame, but some have option to switch that off, like Bool Test etc.

- In other posts I read there are heavy actions like "find gameObject", maybe there are more?

- OnTriggerStay, there are lots of topics that this shouldnt be used, but I have a question.
If I use it like for 0,2 sec does that take lots of performance…?
I use it when Player enter a trigger, trigger waits for exit, but if another player enters and exit, trigger checks with OnTriggerStay for 0,2 sec if there are other players in zone and goes to another state. Is that OK?

Seeing these type of topics gets me thinking, maybe its a good idea to collect these "heavy / notRecomended / useWithCaution" actions in a sticky post with tips?
Most part the performance is in your hands how you make the app/game, but these "tricky" things is good to know.
Title: Re: Performance in Playmaker (Trigger event, Every Frame, Changed etc)
Post by: DennisJensen on July 22, 2014, 03:54:21 AM
jess84:
Wow okay, thats nice to know because I use it some places.

I learned the GUI thing the hard way  :-\

600:
Yeah I totally agree it would be really nice with a sticky that has kind of a overview, especially for mobile games.
Title: Re: Performance in Playmaker (Trigger event, Every Frame, Changed etc)
Post by: jess84 on July 22, 2014, 10:00:29 AM
@600
I initially just used it permanently, then I thought about doing something similar to what you're doing - but the performance was still bad. I then switched to just using Trigger Enter/Exit and bools that flipped instead - and the performance difference was amazing.  I would highly recommend using bools to know whether each player is in/out of your trigger, and then doing Bool All True / None True to figure out what you need.
Title: Re: Performance in Playmaker (Trigger event, Every Frame, Changed etc)
Post by: 600 on July 22, 2014, 10:34:29 AM
Thanks jess84 for tips.
Now I will redesign those places,
If one player exit I could disable and enable the trigger to catch the player still inside (if there are one) with OnEnter.