#Hololens – #Unity3D and error CS0227: Unsafe code requires the `unsafe’ command line option to be specified


I was working and deleting some Assets in one Hololens Unity3D project, when I came across the following compilation error:

Assets/HoloToolkit/Sharing/Scripts/SDK/AnchorDownloadRequest.cs(58,22): error CS0227: Unsafe code requires the `unsafe’ command line option to be specified

If you are .Net developer you understand the context for this error, the message is asking us to enable a compilation flag to compile unsafe code.

My first task was a quick search, and I found the way to do this in Unity is following these steps

  • Create a text file named “smcs.rsp”
  • Edit the file and add the text “-unsafe”
  • Copy the file to the Assets folder in our Unity3D project

1 minute later I was able to build the project without problems. And I went back to see the HoloToolkitUnity contents, and I realize the file was inside it and that was one which I deleted in my “cleaning” process


Lesson learned!

Greetings @ Toronto

El Bruno


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: