Search Issue Tracker

By Design

Votes

0

Found in

2018.2.0b7

Issue ID

1045987

Regression

No

Unity allows user to make two layers with the same name and thus introduce Physics API behaviour inconsistencies

Physics

-

How to reproduce:
1. Open newest tester-submitted project (2Layers1Name.zip)
2. Open "SampleScene.unity" scene
3. Investigate "CollisionTest":
* One sphere is set to layer "Water", the other is set to second "Water" layer instance
* Both cubes are set to "CollisionLayer" layer
* When the scene is played, one sphere collides with cube below, the other falls through(This is intended according to ProjectSettings->Physics->Layer Collision Matrix)

4. Investigate "BounceTest":
* Cube is set to detect bounce of "Water" layer(Notice that LayerMask shows only one instance of "Water" layer)
* Sphere is set to the second instance of "Water" layer
* Play the scene and observe LayerBounceDetection.cs script messages that an unknown layer has hit the cube even though Cube should identify sphere layer as the desired one

5. Investigate "RaycastTest":
* Notice the sphere layer is again set to the second instance of "Water" layer
* Blue raycast("Force of Water") searches for second "Water" layer instance by layer name but instead get the first one and thus does not collide
* Green raycast("Force of Nature") searches for second "Water" layer instance by layer index and is successful - hits the sphere
* Red raycast("Force of Fire") searches for second "Water" layer instance by LayerMask that is defined in inspector but it get the first instance and does not collide too

Expected result: Unity does not let users create a layer with a name that is not unique
Actual result: Unity does let users create a layer with a non-unique name thus introducing inconsistency in physics behaviors

Reproducible with: 2017.1.4p1, 2017.2.3p1, 2017.4.5f1, 2018.1.4f1, 2018.2.0b7

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.