Physics Layer Test

by xTiming

Unity project showcasing the inconsistency of the Physics2D collision matrix option in Project Settings when instantiating objects during runtime.

( Crawled 34 minutes ago )
+

UNITY VERSION: 2017.1.0p4

Unity project showcasing the inconsistency of the Physics2D collision matrix option in Project Settings when instantiating objects during runtime. Open this and run it from the Unity editor. Inspect the contact points and watch for collision/trigger events of each Player when moved to collide with Players created earlier & later. Review the Physics2D project settings to verify collision matrix is setup properly.

Basic setup of Player prefab:

- Main object is on the Entity layer and holds the RigidBody2D and the non-trigger Collider2D.<br>
- Child object is on the EntityTrigger layer and hold the trigger Collider2D for stopping Players moving through/pushing each other.<br>

Expected results:

- Players can never move through each other, nor push each other.<br>

Actual results:

- Players created earlier can push Players created later, Players created later have the expected behavior.<br>
- No collisions or contacts are made between layers that should not interact with each other, even though earlier Players can push later Players.<br>
- Collisions with the static rigidbody always works as expected.<br>

The blue square is a static rigidbody.
Click Instantiate Player to create a new dynamic player.
Switch between control of players using the dropdown menu.