I’m having a banal problem, and i can’t believe what’s happening. I’ve got the Gunpoint Object that is attached as a child of the player, with these settings:
When it comes in contact with Pickup in the scene
Box Collider 2D is disabled on purpose, it is turned on on runtime, read about it in the last paragraph.
An event should be triggered
Layer collision matrix is all set
Z positions are aligned (2D game, everything uses 1 for Z transform value and yes, children are on 0 local, so they’re on 1 global), i even tagged the Pickup Prefab, but still no collision is detected. I must be missing something banal, i tried all sorts of combinations of rigidbody types, IsTrigger checked or not, discrete/continuous collision detection and nothing works. Colliders on both bodies are pretty big.
As for the structure of the object carrying the Gunpoint object which should collide, it goes like this:
Player - Collider2D with non IsTrigger, Player Layer
Gunpoint - Collider2D with IsTrigger, as attached in the image, Gunpoint Layer
PulseGunLevel1 - Disabled Collider2D with IsTrigger, Pickup Layer
The PulseGunLevel1 which is a child of Gunpoint object is the same object that Gunpoint should collide with (that means there are two instances on the scene). Since they both spawn on runtime, that is the reason that i have, for testing purposes, disabled the collider on the prefab, as you may noted in the second image, so it stays disabled on the instance childed under the Gunpoint object, and i enable it manually on the pickup instance. I made so many layers to make sure nothing collides unintentionaly since there’s obviously a problem.
Trigger is Playmaker controlled (you can find the code below). It works, the code is pretty basic and it has been used with no problems on numerous occasions (though never on colliders of nested objects). Unity is 2017.0.2f.