Hi everyone,

I'm converting some csharp code from a unity project to godot, the code uses the unsafe and fixed keywords, when I try to run it, it says "Unsafe code may only appear if compiling with /unsafe"

I guess there's an option somewhere in the project settings to allow unsafe code but I can't find it and googling hasn't provided much help, anybody know how I can do this?

Thanks!

Welcome to the forums @Bernard1971!

In the .csproj file, you should be able to tell it to compile with unsafe code, if I understand correctly. I think you just need to add the following, based on this source from Microsoft:

<PropertyGroup>
	<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

Hi,

I added the AllowUnsafeBlocks property group and my code compiles now ?

Thank you!

2 years later