Search Unity

Errors when Porting Unity Project to UWP for Windows Mixed Reality

Discussion in 'Scripting' started by 265lutab, Dec 14, 2017.

  1. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I am porting my unity title from the Windows platform for the Oculus and HTC Vive to Universal Windows Platform for Windows Mixed Reality.

    I'm using Unity 2017.2.0p2

    It appears there are some libraries that are not being included or that are not supported by UWP. My title will run in the editor without problems, but when I build the game I'm getting a number of errors mostly saying that 'x' does not contain a definition for 'y'.

    Here are the errors I'm getting (There are a lot more errors than this, but they are mostly duplicates of these from when something is referenced more than once.)

    Here is the full error log

    https://drive.google.com/file/d/1ww6ez4O891nSh6HI0CC-Cv6Ex5M6aTBA/view?usp=sharing
     
  2. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Basically, when you target UWP, you're compiling with WinRT. Which is essentially a trimmed down version of .NET (meant to be "more secure", etc.).

    This is actually the kind of thing .NET Standard 2.0 is meant to solve, since it brings back most of the missing APIs. UWP now supports .NET Standard 2.0. Unfortunately Unity isn't there yet. They've said that they expect to have .NET Standard 2.0 support in 2018.1.

    Until then... if you need to support UWP right now, you have some research to do to find the equivalent API to use to replace the missing ones (DatagramSocket instead of UdpClient, etc.)
     
  3. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    Last edited: Dec 14, 2017
  4. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    .NET scripting backend will never support .NET standard 2.0. We'll drop support for it before we ever get there. It will be supported through IL2CPP in 2018.1.

    Using IL2CPP should work, and I have no idea what that error means. It Seems like something in your system is crashing, rather than the app? Are you able to run other mixed reality apps on your headset?
     
  6. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I am able to run other MR apps without a problem. My Game also runs fine in the Unity editor, but when I run it from Visual Studio I just get black in the headset then things start to slow down before the system freezes.
     
    Last edited: Dec 14, 2017
  7. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I was getting a similar result in the Unity editor when I commented out the line causing this error

    Could it be that it is building, but ignoring some things that aren’t supported like MethodImplOptions.Synchronized?
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    No, these things should work fine on IL2CPP. I don't think the crash you're seeing is related to that error. Does the game end up crashing? Or does the system crash before that?
     
  9. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I think the system freezes as the game is crashing. I got the error message then it was frozen.
     
  10. ScottF

    ScottF

    Vice President, Platforms

    Joined:
    Jul 31, 2013
    Posts:
    96
    Can you confirm your PC is on Windows 10 RS3?

    Are you able to connect a Windows Mixed Reality headset and the Mixed Reality Portal is working? I saw you also posted on the MRTP thread so it looks like you are on the correct build.
     
  11. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    The Mixed Reality Portal runs without problems. I'm currently on windows build 16299.125 and I'm using unity 2017.2.0p2-MRTP.
     
  12. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I stopped it before the system froze this time and this is the debug output I got in Visual Studio

     
  13. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I also saw in one of the most recent posts on the MRTP thread that all the fixes have been added to 2017.2.1f1. Would I be better off switching to that build of unity?
     
  14. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I was able to get it to work with a simple scene from the same project. I think it might be a memory leak. I have seen it give me the message "out of memory" before Visual Studio has crashed and restarted. It has done that a few times instead of the whole system crashing.
     
    Last edited: Dec 15, 2017
  15. Gabrio

    Gabrio

    Joined:
    Jan 31, 2016
    Posts:
    17
    Hi, was long time ago, but did you find a solution for the memory leak? I'm using DatagramSocket too and I go in "Out of memory" when reading from udp.