0
Working on Fix

lag spike on first collision with "ontrigger"

Joshua Dudley 4 weeks ago • updated by baumxyz 5 days ago 9 1 duplicate

i hope some one can help.on android i keep getting a lag spike on the first time a "ontrigger enter" collides with a game object the code works after the lag and the lag dosnt happen again till you reset the game even if youhit the same object. the lag spike is relay bad on my cheep phone and about half as bad on my s8

i recreated the error on a empty game and its still there

i only have 2 objects in the game the moving one has ridged and a sphere collider and and the still one has a box collider set to trigger. im not using the 2d ridged body because i'm hoping to make a 2.5D game

the only graph in the game

same error is on pc but way smaller

Bolt Version:
1.4.2
Unity Version:
Unity 2018.2.17f1 and a few earlier versions
.NET Version:
3.5

Duplicates 1

Under Review

Hi Joshua,

Sorry you're experiencing this lag. It's likely that Bolt is initializing some things in its event system the first time they're required, and then caches them so that's why it's fast for any subsequent event.

If you use the Hierarchy view in the profiler, you could dig down further in the cause of the lag, allowing me to maybe isolate what's causing it and optimizing it.

i think this is what you need ps. thanks for reminding me about the Hierarchy view lol

this most likely wont help you but i only found one person online with a slimier problem just not using bolt and im not using any text. but thought this might help

https://answers.unity.com/questions/1333748/frame-droplag-spike-ontrigger.html

This happens only the first time I enter the trigger. If I re-enter the trigger area the event gets fired immediately. 

haven't found a fix yet but I think they're working on it

Hey Lazlo Bonin, thanks for merging the 2 topics. But I think my posts got deleted :(

Working on Fix

Hey all,

Thanks for the report. I think I found the cause of this. It seems that somewhere along the previous updates, the Prewarm step got skipped. Prewarming is basically caching a bunch of things that the graph will use later to avoid lag spikes like these. I'm restoring prewarm on instantiation for the next version so that this spike won't happen anymore!

thanks for all the help. bolt is an amazing program

Thanks, Lazlo. I am glad and grateful that you were able to identify the problem. :)