Search Issue Tracker
By Design
Votes
0
Found in
2018.3.0a6
2018.3.2f1
2019.1.0a1
2019.2.0a1
Issue ID
1120533
Regression
No
Raycasts hit the GameObjects that are in the Scene when used in the Prefab Mode
How to reproduce:
1. Open the "Main Scene" in the attached "PrefabCollisionBug.zip" project
2. Double click on the "Sample Prefab" in Prefabs folder to enter a Prefab Mode
3. Try to move the whole Prefab on the Y axis
Expected Behavior: Raycasts hit only to the objects that are in a Prefab Mode
Actual Behavior: Raycasts hit to the objects that are in the Scene rather than in Prefab Mode
Reproducible with: 2018.3.3f1, 2019.1.0b1, 2019.2.0a2
Note: Green Raycasts show Colliders while red ones show that it did not find a Collider. Could not test with 2017.4 because it does not have a Prefab Editor. The functionality seems to work partly on the 2018.3.0a6, but Scene GOs are not ignored either. (added a screenshot)
Comments (1)
-
angelonit
Jun 10, 2021 01:15
I made an editor script to "Put objects from a list on the ground" using Physics.RaycastAll and Found the Physics.Raycast/Physics.RaycastAll calls return null on the "Prefab Mode" while they do work if I put the prefab in the scene and use the script from there instead of in "Prefab Mode" (doing that and then hitting override to save the prefab changes was my workaround)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Incorrect color values are saved for Swatches when using HDR Color Picker
- Editor crashes when adding/removing a UI Document Style Sheet while in Play mode
- Scene and Game views turn black when all light sources are disabled
- Memory spike after activating Freeform Light2Ds
- Line Renderer Component elements do not fit in the Inspector window when minimising Inspector window is minimised
Resolution Note (2019.2.X):
With a new prefab system we also introduced a physic's world separation and this needs to be taken into account.
I've changed the script that draws collisions a little bit to be aware of this separation :)