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.
- Crash on MemoryManager::Deallocate when reimporting VFX Graph Asset
- Crash on CachedWriter::Write when building AssetBundle
- Build crash when loading next scene
- Debug.Log applies formatting for date and time in the DateTime struct when using string interpolation
- [IL2CPP] Build fails to compile when Development Build option is enabled