Search Issue Tracker
C# 6 null conditional access operator (?.) throws MissingComponentException instead of recognizing as null
1. Open attached Unity project "CSharpBug.zip"
2. Open "TestScene" scene
3. Inspect both "ThrowsException" and "Safe" GameObjects and scripts attached to them
4. Go into play mode
Expected result: Both scripts should yield the same results (print the success message)
Actual result: In Throws Exception script, there is a ?. operator which works as a check whether the object is null or not. Instead of ignoring the whole line of script, as meshfilter in this case is null, MissingComponentException is thrown.
Reproduced on: 2017.1.0p3, 2017.2.0b7, 2017.3.0a4
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Rendering is broken with UIToolkit with many Intel GPUs (driver-bug)
- [Vulkan] Crash in Windows Standalone when Vulkan is set as rendering API and player window is out of focus
- [Particle System] Editor freezes when assigning a nested Particle System in the Sub Emitter Module
- Unable to switch to different material when selecting another material from Asset selector window on Particle System Material
- [UI] Float type parameter in the Animator Controller displays 0.0 after being changed to a value <0.05