explicitNullChecks
When true, null references are actively validated in C++ generated by IL2CPP. When false, they are not.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Property
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public static bool explicitNullChecks { get; set; }
Remarks
This setting is only supported for some closed platforms. On those platforms it's a configurable option in the platform build profile, and more information is available in the relevant platform-specific documentation.
Important:
- It's strongly recommended to keep null checks on. Turning them off can improve runtime performance, but doesn't prevent attempts to access null values, which can lead to unintended behavior including crashes. If you choose to turn null checks off, you must ensure that no null access occurs in the affected code.
- On the platforms that support this setting, it applies globally to all C# code. It's recommended to use the attribute instead, which is supported on all platfoms and allows you to apply the equivalent behavior more restrictively to specific methods, classes, or assemblies. For more information, refer to IL2CPP runtime code checks in the Unity manual.
[Il2CppSetOption]