Common faults i found while using Unity
You cannot call GUI-Elements or even other Unity internal related functions from another thread.
If you do that, Unity will NOT give you an error, it will implode in itself silently.
Your Monobehaviour-Script will just stop executing but not stop running. Like a zombie, it will remain.
Thats why there is no error, it did not technically fail.. it just locks up.
If you intent to use inheritence, good luck.
As C# does not allow multible class-inheritence and Monobehaviour blocks the only one, you are required to make chain-inheritence.
Classes that do not use Monobehavior can be used as normal, its really just a smal inconvinience but still.
string myString = new string(myStringBuffer, 0, myStringBufferLength, System.Text.Encoding.UTF8);
The fix is to just not tell. Otherwise it will fail internally while parsing the buffer.
string myString = new string(myStringBuffer, 0, myStringBufferLength);
Reference rewriter: Error: method
System.Char& modreq(System.Runtime.InteropServices.InAttribute) System.String::GetPinnableReference()
doesn't exist in target framework
fixed(char* myStringAdress = myString)
{
// Do stuff
}
The fix is solved by adding "ToCharArray()" to the string instead of letting the language handle the problem.
There seems to be a hidden function call that does not exists in this older version.
fixed(char* myStringAdress = myString.ToCharArray())
{
// Do stuff
}
This requires to export as UWP in the build settings in Unity but also has effect on external DLLs.
If you want to use C code in your Hololens 1 project, too bad. As the UWP-System does not compile under strict C-Code rules.
You NEED to compile as C++, meaning you need to use .cpp extension and have the correct compiler seiitings set up.
Additionally you are forced into compiling your DLL as expected but as a UWP DLL.
You need to change some settings to use the C++/CX Windows runtime system.
Microsoft Guide
This way of setting up did not work for me.
Annoying but working solution is to just make a new project "DLL C++/CX UWP" and just make a wrapper library.