Search code examples
c#dllunity-game-engineunsafe

Unity3D Unsafe code requires the `unsafe' command line option to be specified


i am using Unity3D 4.3 and calling a DLL that i created. when trying to call the only function it have which is this:

void GetModelReferences(int &nVertices, float * vertices, int &nTriangles, int * triangles, float * normals, float * uvCoordinates);

unity gives me an error:

Unsafe code requires the `unsafe' command line option to be specified

so in my MonoDevelop i opened : Project->Assembly-Csharp options and turned on the unsafe mode.

it reduces part of the errors but this last one wont go away

Unsafe code requires the `unsafe' command line option to be specified

what shoud i do?


Solution

  • Go to your project properties page and check under Build the checkbox Allow unsafe code. This should solve your problem.