- Home /
The question is answered, right answer was accepted
What are Explicit Null Checks for?
I'm making a build of my game and noticed the 'Explicit Null Checks' tick-box in the build settings.
What does it do?
When should it be enabled and when should it not?
Answer by RobAnthem · Feb 08, 2019 at 03:30 PM
Simply put. IF you have this set to true, your game will crash when it hits a null object. If it is set to false, your game will attempt to continue to run.
ideally a good programmer makes null checks everywhere that is necessary, and some places it would be redundant, but redundancy is good in programming. However, a programmer can't account for EVERYTHING, or forgets things, so sometimes null references still occur. This option exists to let the developer how to decide to handle those exceptions during runtime.
Great explanation, thank you!
If you want to copy & paste it into the Answer bit below, I will mark this as resolved ;)
Thank you for this answer but from my tests, it actually worked the opposite way.
When set to true, after a NullReference my game has an exception but continues to run. When set to false, after a NullReference my game froze there.
I tested this on a console build.
Follow this Question
Related Questions
How to create a BuildOptions mask in the Editor Window? 2 Answers
What is the difference between BuildTarget and BuildTargetGroup 0 Answers
Not building anything and there is not even a build popup (win 10) 0 Answers
How to add custom Proguard files to build.gradle? 1 Answer
Excluding resources when building 2 Answers