Search Unity

#elif Invalid preprocessor directive

Discussion in 'Windows' started by TonyWongHulu, Jun 16, 2017.

  1. TonyWongHulu

    TonyWongHulu

    Joined:
    Jun 3, 2016
    Posts:
    17
    Hi,

    I'm porting to UWP, but I get quite a lot of compiler errors (e.g. Array not having ForEach), one of which is #elif being invalid. Is this correct? Is there typically a lot of patching needed to convert to UWP?

    Thanks!
    Tony
     
  2. TonyWongHulu

    TonyWongHulu

    Joined:
    Jun 3, 2016
    Posts:
    17
    Ah I guess in mono you can do #elif with nothing else but in .net you need #elif false or something.

    But I'm still curious if typically there are a lot of changes like this when porting to UWP?
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    UWP has two scripting backends.

    The first scripting backend is .NET. It uses a different .NET profile as it is controlled by Microsoft and therefore many types and methods are missing in it. It's usually a lot of work to port games from other platforms to this scripting backend due to all the differences I mentioned. It is currently the default, but that will be changing soon. We're on the way to deprecate it.

    The second scripting backend is IL2CPP. It uses the exact same class libraries as the editor or the standalone player, therefore all the types and methods that worked in the editor will compile on UWP when you're using IL2CPP.

    I suggest you give IL2CPP a shot, since it's a much more pleasant porting experience.
     
  4. TonyWongHulu

    TonyWongHulu

    Joined:
    Jun 3, 2016
    Posts:
    17
    Yes, I switched to IL2CPP and that fixed most of my errors. Thanks!