lag spike on first collision with "ontrigger"

Joshua Dudley 3 years ago updated 2 years ago 20 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:
Unity Version:
Unity 2018.2.17f1 and a few earlier versions
Scripting Backend:
.NET Version (API Compatibility Level):

Duplicates 1

Pending 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


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. :)

im sorry but im still having the same bug

and for some reason on my main game that I updated to 1.4.4  I lost all my scene variables after hitting play and stop a bunch of time for some quick testing. not sure if this has to do with my bug or not but it was odd it happened after updating 

this is a new game with the same basic test setup as my last one. one on update flow machine and one on Collison flow machine.

Pending Review

I'll have another look. Was there any improvement?

I think it's about the same. it's even still there on pc at about the same levels, although a few times I couldn't find the glitch in the profiler. but I think it was there just hard to see sense it was always a small glitch on pc

 this is a new blank project with no adjustments to any settings aside from setting it to android and importing bolt from the asset store. all external tools are set to be installed by unity.

sorry and thanx for the help

these images are from a pc

and it could be related but on the first touch, the same thing happens... I can try and get some images of that later today if you want. I'm not sure what I'll find iv never looked at that glitch in the hierarchy view of the profiler...just found out how to get to the hierarchy view lol.

this has been happening the holt time too but was less important sense I could hide the skip with a touch too start button


Hi Joshua,

Sorry for the very late reply on this.

I can confirm the prewarm fix reduced the lag, but indeed not completely. We've decided to postpone the fix as it would require a major refactor to preload more data without bloating memory usage. 

In Bolt 2, this won't be an issue because you'll be running from C# scripts directly.

I apologize about the inconvenience, I hope you can work around it in your design.

thanks for the reply.

its ok, I thought it might be something like that.

keep up the good work, I can't wait for bolt 2.