Unity3D Unsafe code requires the `unsafe' command line option to be specified
Go to your project properties page and check under Build
the checkbox Allow unsafe code
.
This should solve your problem.
Here is what worked for me with Unity3D 5.3:
- If in your Unity Build Setting->Player Setting->Other Settings, "API Compatibility Level" is ".Net 2.0", create a file under your Unity Asset folder called gmcs.rsp, add this following line to the file:
-unsafe
Close Unity and open it again.
- If the "API Compatibility Level" is ".Net 2.0 Subset", the above file name should be: smcs.rsp.
See the picture bellow to find the location of ""API Compatibility Level" setting in Unity.
The answer is given here: http://answers.unity3d.com/questions/804103/how-to-enable-unsafe-and-use-pointers.html
You need to add a file "smcs.rsp" (or "gmcs.rsp") in your "Assets" directory, which contains the line:
-unsafe