allowUnsafeCode
Allow unsafe C# code to be compiled for predefined assemblies.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Property
- Namespace: UnityEditor
- Assembly: UnityEditor
public static bool allowUnsafeCode { get; set; }
Remarks
Enable to pass to the C# compiler when compiling predefined assemblies, such as . This setting only affects code that isn't compiled into separate assemblies via files.
/unsafeAssembly-CSharp.dll.asmdefEnable this only if your project requires direct pointer manipulation for extreme performance or native C++ interoperability. For general high-performance data handling, consider using or first.
Unity.CollectionsSystem.Span<T>Warning: Code compiled with flag can bypass the .NET runtime's memory safety. An invalid memory access typically crashes the application or the Editor without a stack trace.
/unsafeNote: For assemblies, enable the Allow 'unsafe' Code checkbox in the Assembly Definition Inspector instead.
.asmdef