Search Issue Tracker
By Design
By Design in 2023.2.X
Votes
0
Found in
2020.3.45f1
2021.3.20f1
2022.2.9f1
2023.1.0b6
2023.2.0a4
Issue ID
UUM-28417
Regression
No
Phsyics.Raycast throws a NullReferenceException when used without the maxDistance argument
Reproduction steps:
1. Open the attached “Repro.zip” project
2. Open the “Assets/Scenes/Puzzle.unity” Scene
3. Enter the Play Mode
4. Press on the Rubik's Cube on the left side of the Game View
5. Observe the Console
6. Press on any of the white cubes on the right side of the Game View
7. Observe the Console
Expected result: No errors are present and “Hit something in the Input Layer” is printed in the Console
Actual result: NullReferenceException is thrown and “Hit something in the Cube Layer” is printed in the Console
Reproducible with: 2020.3.45f1, 2021.3.20f1, 2022.2.9f1, 2023.1.0b6, 2023.2.0a4
Reproducible on: Windows 10 (21H2)
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
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
- Entities Hierarchy Search “Show/Hide” button’s Lens Icon is blurry when the Editor is on an external monitor
Resolution Note:
Physics.Raycast doesn't throw the exception here, a user script that looks for a component after registering a hit does.
Also the LayerMask is being passed as maxDistance, that's why the raycast is returning an unexpected hit.
Resolution Note (2023.2.X):
Physics.Raycast doesn't throw the exception here, a user script that looks for a component after registering a hit does.
Also the LayerMask is being passed as maxDistance, that's why the raycast is returning an unexpected hit.