playMaker

Author Topic: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike  (Read 3741 times)

mpaul0055

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
Hi All

We are in the final stages of optimization for our VR mobile release of Affected.

Im having a few issues with Playmaker and a few of the triggers I have created.

One trigger actually hurts performance by 50% which causes a large drop in frames which is VR has to be avoided.

Ive also noticed that triggers are constantly being called, and even simple ones seem to use about 0.6% while doing nothing, is this a normal behavior?


Ive attached an image as this seems massively excessive. Any advice would be greatly appreciated.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #1 on: March 07, 2016, 08:03:14 AM »
What version of Playmaker and Unity are you using?

mpaul0055

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #2 on: March 07, 2016, 08:04:35 AM »
Hi Alex

Im using Unity 5.3.1p and Playmaker 1.7.8.3

Thanks

Mark

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #3 on: March 07, 2016, 11:55:21 AM »
You should upgrade to 1.8.0.

In 1.7.x proxy components were added at runtime to handle trigger events.
In 1.8+ these components are added as part of the build step, not at runtime.

This is likely the cause of the spike you're seeing.

mpaul0055

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #4 on: March 07, 2016, 02:33:53 PM »
Thanks Alex.

I thought i had got the latest version installed, but clearly not.

Im now running v1.80, but still getting a physics hit of around 40% when we hit a trigger, and now its every trigger. Not noticeable in low poly areas, but when we are close to maximum performance the dropped frame is very noticeable as you jump about a 2ft down the corridor.

Ive also got another spike thats occurring since updating Playermaker which is GC.Collect. Its spiking at about 85% and ive never seen this before.

Any help would be greatly appreciated.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #5 on: March 07, 2016, 03:20:17 PM »
Are you profiling in the editor or a build?

mpaul0055

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #6 on: March 07, 2016, 04:21:15 PM »
In the editor, ill test on the phone tomorrow and report back.

mpaul0055

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #7 on: March 08, 2016, 04:05:42 AM »
While the trigger spike is still noticeable in game, its not as prominent, but it is certainly still there. 48% performance hit when you enter the trigger with a 7.8ms spike in profiler.

This is with Playmaker 1.8.0  and Unity 5.3.3p1 & Unity 5.4.0b8

Also, just a heads up, We have this error in 5.4.0b8

SetLogCallbackDefined is not allowed to be called during serialization, call it from Awake or Start instead. Called from script 'FsmEditorWindow' on game object ''.
See "Script Serialization" page in the Unity Manual for further details.
UnityEngine.Application:add_logMessageReceived(LogCallback)
HutongGames.PlayMakerEditor.FsmDebugger:.ctor() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmDebugger.cs:51)
HutongGames.PlayMakerEditor.FsmDebugger:.cctor() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmDebugger.cs:22)
UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String)
UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean)
« Last Edit: March 08, 2016, 07:32:45 AM by mpaul0055 »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #8 on: March 08, 2016, 07:39:34 AM »
What other work are you doing on that event? E.g., are you spawning any objects, or doing something for the first time? Can you expand the profile to show the sub entries? And/or can you PM me a link to the project so I can take a look...?

mpaul0055

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #9 on: March 08, 2016, 08:39:36 AM »
Hi Alex

Ive attached another image of the profiler, but ive just created a simple trigger that activates one game object, and the same spike happens. In fact on this one its 58%.

Im happy to upload the project although it is quite large. We are going to stick with 5.4.0 as its resolved some Culling Performance issues we had with 5.3.3.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #10 on: March 08, 2016, 09:56:25 AM »
The percentage is not so relevant - it's the "Self ms" that's most important to compare. Looking at those figures, iTween Awake and iTween Start are taking most of the time. iTween creates components when it starts tweening which can cause hitches on mobile devices. There are alternative tweening engines that don't create components if you search on the forums. I believe HOTween has better performance than iTween.

It's also important to profile on the device. Playmaker does extra logging in the editor that it doesn't do in the build.

We are aware of the build errors in the 5.4 beta. I'll send you a PM invite to the Playmaker Beta Group so you can get access to the fixes asap.

I'll also run some tests here to see if there are any optimizations we can make to the PlayMakerTriggerEnter component.

crazygoose998

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #11 on: March 08, 2016, 10:18:12 AM »
Thanks for help guys! It already helped me a lot!
Hello fellows! I live in a marvelous city named Bethesda. I am a huge lover of entire Westchester county. I work for numatic george company. It is a foreign limited liability company.

mpaul0055

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #12 on: March 14, 2016, 12:25:15 PM »
Hi Alex

I thought id make this public in case other users have the same issues.

Ive attached another photo of the profiler which still shows the trigger spike still occurring while not using iTween.

This is using the latest Unity 5.4.0b9, so once we have the beta playmaker I will report back any results.

Thanks

Mark

mpaul0055

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #13 on: March 15, 2016, 02:23:56 AM »
Hi Alex

What do you think of the above now the trigger does not have any itween actions attached.

The object its activating is a spot light attached to the player.

Thanks

Mark

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: playmakerTriggerEnter.OnTriggerEnter() - Huge Performance Spike
« Reply #14 on: March 15, 2016, 08:50:50 PM »
I haven't been able to reproduce the problem here. Do you have multiple triggers firing in a single frame? Maybe the 2ms is the total for many triggers? Can you select Raw Hierarchy in the Profiler to check the cost of individual triggers.

Is that profile on the device or in editor? Are you still seeing hitches on the device without iTween?

I sent you an invite to the beta group. Please try the latest build since it fixes build issues with Unity 5.4, which might be related.