I noticed that one of my coroutines which moves a couple of objects around each x amount of time was being slow.
When investigating it in the profiler, I found it was doing static collider moves.
Static collider moves only happen when you move an object with a collider, but without a rigidbody.
Well, all my objects with colliders have kinematic rigidbodies. All of them, I check multiple times to be sure.
So, where are these static collider errors coming from?
I was investigating more, and I found this in the profiler a short while (1.5 ms) after starting the game:
On terrains it seems to always create it at least in 3.1 (delay of 1.1s on my core i7 920 @ 3.2ghz), even with the terrain collider removed. if I would have to guess then I would assume that potentially at least there foliage / detail object usage might have to do with it, is that possible? (thats the only thing we use from it, we actually use pure meshes for all the rest and use terrains just for these 2 things thus wanted to get rid of that 1s++ stall)
From the fact that it takes time, I would be unable to make a difference from 1-4s I guess
Problem is that it has to run on much weaker hardware where people will really wait.
But I first need to run the test again in the original setup cause the attempt to replicate it failed just a few mins ago in the current version of the project as it stands now.
Question is what could impact it to cause a generation of a collider during the scene loading even if the terrain didn’t have one present. Totally in the dark here.
So for the time being I will have to take back what I mentioned (I only use the profiler on specific situations as it impacts the behavior on its own especially as we are loading quite a bit through WWW after the scene init too), should I be able to replicate it again I will report a proper bug including project, in the hope its not just cause by some data error or whatever.
Yeah, then just drop the case number.
We’re deep in release mode - so noone have enough time to just look at any problem someone might encounter without proper repro
The object has multiple children (4) with box colliders on them, to correctly follow the shape of the object.
When I deleted all child colliders, and created just one collider on the parent object, I got no more warnings about static collider.move’s and collider.creates!
However, having colliders on children of a rigidbody should be perfectly possbible. It’s just a compound collider.
I have to say though, not all colliders of the object hit all other colliders. Is something going wrong with the compound collider creation?
Will investigate more.
edit:
I reverted to my version of the object with the 4 child colliders, but instead of having a rigidbody on the parent, I created a kinematic rigidbody on each of the child colliders instead. I still had a rigidbody on the parent as well. This fixed my issue!
If I removed the parent rigidbody, so had only rigidbodies on the children, the problem was still there. I did hear that having rigidbodies on both a parent and its children isn’t smart to do. Is that true? Else I’ll use the current solution as a workaround.
So, it seems having a kinematic rigidbody with multiple child box colliders and moving that object around (by changing Transform position) goes totally wrong. It will just create static colliders. This seems to be a big bug. Can anyone duplicate it?
Ok, while we are working on the proper fix here is the workaround for situations where you have RigidBody on parent and colliders on Children.
All thanks goes to ThomHurks himself!
deactivate only children objects. While this have some limitations - in most cases you’ll be good to go
I am having a similar problem, although I have no rigid bodies on either the parent or child objects, only box and sphere colliders. According to the profiler it seems that there is a static collider being created, and I suspect it’s messing up my performance.
Is there any workaround for this situation that doesn’t include rigidbodies?
I am using the 3.4.2f1 beta, but I’ve had this problem since before this version.
I have the same problem. Many objects with colliders, not marked ad Static, no rigidbodies, but when i move them i see in the profiler that line “Static Collider.Move (expensive delayed cost)”
Why?