I haven’t come across this before so I’m not sure what to make of it.
I have an enemy with a MeshCollider that is enabled while the enemy is alive. Once the enemy is dead, the MeshCollider is disabled, however somehow it’s still triggering a collision with the player.
Image 1. TOP HALF: The enemy is alive and you can see that the MeshCollider is enabled
Image 2. BOTTOM HALF: The enemy is dead now and you can see that the MeshCollider is now disabled
Image 3. I set up a Debug.Log to output what the player is colliding with. It shows that it is indeed colliding with the MeshCollider which is still disabled.
I should point out that the scripts I’m using are the same for all my enemies but this enemy, so far, appears to be the only having this problem. The others are mostly Box Colliders as apposed to MeshColliders, if that makes any difference.
Am I doing something obviously wrong?
I recently had the exact same problem. One workaround I found is to disable the mesh collider and its “isTrigger” option at the same time.
I am having the same problem as well… I can only guess this is a bug.
My issue is, to save on performance I will sometimes temporarily convert Mesh Colliders to Box Colliders during runtime (by creating new Box Colliders, and disabling the Mesh Colliders)
My issue is that this will either still cause collisions and/or cause MAJOR performance issues.
@noodle! : disabling the isTrigger option does not change anything on my end, neither does changing any other setting in the collider component
One work around I did find is to store the Colldier mesh variable (collider.sharedMesh) in a script temporarily and set the collider.sharedMesh to null… when I want to re-enable the mesh collider, I will restore the saved mesh variable back to it’s collider.
Annoying, but it seems to work as you would expect disabling the collider would.