IL2CPP support?
Does this package support being compiled with IL2CPP? I just tried doing that but got a bunch of errors like this:
Assets\Plugins\HoloToolkit\SpatialMapping\Scripts\RemoteMapping\MeshSaver.cs(10,24): error CS0234: The type or namespace name 'Tasks' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?)
Assets\Plugins\HoloToolkit\SpatialMapping\Scripts\SpatialProcessing\SurfaceMeshesToPlanes.cs(11,24): error CS0234: The type or namespace name 'Tasks' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?)
Assets\Plugins\HoloToolkit\CrossPlatform\Scripts\Reflection\ReflectionExtensions.cs(90,59): error CS0246: The type or namespace name 'TypeInfo' could not be found (are you missing a using directive or an assembly reference?)
@NeerajW Is this something we hope to target?
@svermeulen I don't believe we do. What is your scenario? You could try to compile it yourself using the https://github.com/Microsoft/HoloToolkit repository.
This is what I do to reproduce it:
- Clone repo
- Open directory in Unity 5.5 beta 7
- Change to Windows Store platform
- Click Player Settings and change to IL2CPP
- Run a Build
- Observe errors
I'd like to create my app using IL2CPP because some of the libraries I'm using don't work with .NET backend (but work with IL2CPP). Also I'm assuming that my app will be faster using IL2CPP.
I'm unclear on what you're suggesting about compiling from the other HoloToolkit repo. All I want is to use the unity specific components
Have you tried fixing these errors in those files? I cannot have a requirement on scripts to always test/support this option. Feel free to issue a PR with fixes. Thanks!
Ok sure I will take a look and submit a pull request if I end up fixing it
https://github.com/Microsoft/HoloToolkit-Unity/issues/265 Wasn't targeted explicitly for ILCPP but please check and see if this fixes the issue for you.
@svermeulen any update on this?
This could become an option sooner rather than later; Unity 5.6 recently added support for calling Windows Runtime APIs from IL2CPP code, which wasn't possible before. It also exposes .NET 4.6 API, so those errors in the first post should be gone now.
https://docs.unity3d.com/Manual/IL2CPP-WindowsRuntimeSupport.html https://forum.unity3d.com/threads/will-2017-1-support-async-await-on-xbox-one.464972/
The errors are gone indeed; the remaining problem is caused by SWIG passing non-static method delegates to native code. IL2CPP is currently able to convert delegates to function pointers only when the delegate is a C# static method.
Hi, sorry to reopen the issue, but at my side it still not working. I have just created a new project and added the Holotoolkit as explained in the GetStarted.md (Using the ClickThroughExample). But when I try to compile i have 3 errors
Assets\HoloToolkit\SpatialMapping\Scripts\RemoteMapping\MeshSaver.cs(162,53): error CS1061: 'StorageFile' does not contain a definition for 'OpenStreamForReadAsync' and no extension method 'OpenStreamForReadAsync' accepting a first argument of type 'StorageFile' could be found (are you missing a using directive or an assembly reference?)
Assets\HoloToolkit\SpatialMapping\Scripts\RemoteMapping\MeshSaver.cs(189,53): error CS1061: 'StorageFile' does not contain a definition for 'OpenStreamForWriteAsync' and no extension method 'OpenStreamForWriteAsync' accepting a first argument of type 'StorageFile' could be found (are you missing a using directive or an assembly reference?)
Error building Player because scripts had compiler errors`
I have selected .Net 4.6 for the API compatibility level and used Holotoolkit -> build Windows for building
Sorry for my bad english, it's not my main language.
EDIT Aparently it's working if we remove the content of the preprocessing if and only keep the content of the else
I have run in to this issue as well. it would be useful to have a solution as the MeshSaver.cs gives a good example for storing and reading files on the hololens.
The issue may be on the Unity/IL2CPP side. it appears to be specific to the 'using windows.storage' namespace as this file is the only point that is used. the compiler override switches to Net Core which may be missing the namespace. The question becomes how can we get it added.
I am still getting these errors. Is there anything official I can do about this?
It's fixed. Make sure your project is targeting .net 4.6.
I've also got a PR for the latest version of Unity that fixes a bunch of IL2CPP issues
@StephenHodgson what version are you referring to?
The latest master branch. Unsure if this got into a release just yet.
Confirmed fixed using simon-baehler's solution above. Delete everything within the preprocessor 'if' and leave only the code under 'else'.