Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IL2CPP support? #265

Closed
svermeulen opened this issue Oct 6, 2016 · 16 comments
Closed

IL2CPP support? #265

svermeulen opened this issue Oct 6, 2016 · 16 comments
Labels

Comments

@svermeulen
Copy link

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?)
@jwittner
Copy link
Member

@NeerajW Is this something we hope to target?

@NeerajW
Copy link

NeerajW commented Oct 12, 2016

@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.

@svermeulen
Copy link
Author

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

@NeerajW
Copy link

NeerajW commented Oct 12, 2016

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!

@svermeulen
Copy link
Author

Ok sure I will take a look and submit a pull request if I end up fixing it

@StephenHodgson
Copy link
Contributor

StephenHodgson commented Nov 10, 2016

#265 Wasn't targeted explicitly for ILCPP but please check and see if this fixes the issue for you.

@StephenHodgson
Copy link
Contributor

@svermeulen any update on this?

@Holo-Krzysztof
Copy link

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/

@dimatomp
Copy link

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.

@simon-baehler
Copy link

simon-baehler commented May 31, 2017

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

@jgrif-ibm
Copy link

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.

@eluchsinger
Copy link

I am still getting these errors. Is there anything official I can do about this?

@StephenHodgson
Copy link
Contributor

StephenHodgson commented Oct 6, 2017

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

@jsmith09
Copy link

@StephenHodgson what version are you referring to?

@StephenHodgson
Copy link
Contributor

The latest master branch. Unsure if this got into a release just yet.

@Dmarfurt
Copy link

Confirmed fixed using simon-baehler's solution above. Delete everything within the preprocessor 'if' and leave only the code under 'else'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests