Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Entities and/or Dots Netcode error on iOS build

Discussion in 'NetCode for ECS' started by AdamBebko, Nov 24, 2020.

  1. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    164
    I built my game to iOS and am getting this error in Xcode immediately when it runs. I have no clue what it means.

    The app crashes after displaying an empty scene with a skybox. From what it says it seems the error is something to do with reflection in the entities package. I also submitted a bug report.


    Edit: see additional info in next post.

    Any help would be greatly appreciated! This is delaying me considerably!

    Error:


    2020-11-24 16:03:06.703538-0500 MPDepthdyadic[16431:1417134] Unbalanced calls to begin/end appearance transitions for <UnityViewControllerStoryboard: 0x14b215540>.

    UnloadTime: 2.729125 ms

    NotSupportedException: System.Web.UI.WebResourceAttribute::set_CdnSupportsSecureConnection

    at System.Web.UI.WebResourceAttribute.set_CdnSupportsSecureConnection (System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0

    at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00000] in <00000000000000000000000000000000>:0

    at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0

    at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0

    at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T] (System.Reflection.Assembly element) [0x00000] in <00000000000000000000000000000000>:0

    at Unity.Entities.TypeManager.InitializeAllComponentTypes () [0x00000] in <00000000000000000000000000000000>:0

    at Unity.Entities.TypeManager.Initialize () [0x00000] in <00000000000000000000000000000000>:0

    at Unity.Entities.EntityGuid..cctor () [0x00000] in <00000000000000000000000000000000>:0

    at Unity.Entities.World..ctor (System.String name, Unity.Entities.WorldFlags flags) [0x00000] in <00000000000000000000000000000000>:0

    at Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) [0x00000] in <00000000000000000000000000000000>:0


    (Filename: currently not available on il2cpp Line: -1)


    ArgumentException: Unknown Type:`Unity.Entities.CompanionLink` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].

    at Unity.Entities.TypeManager.ManagedException (System.Type type) [0x00000] in <00000000000000000000000000000000>:0

    at Unity.Entities.TypeManager.GetTypeIndex (System.Type type) [0x00000] in <00000000000000000000000000000000>:0

    at Unity.Entities.AttachToEntityClonerInjection.Initialize () [0x00000] in <00000000000000000000000000000000>:0

    Rethrow as TypeInitializationException: The type initializer for 'Unity.Entities.AttachToEntityClonerInjection' threw an exception.
     
    Last edited: Nov 25, 2020
  2. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    164
    It seems I can fix the above error by removing a line in link.xml that includes log4net.dll.

    I'm using Amazon GameLift, with the AWS SDK. However, This presents a completely different error when I try to connect to Amazon GameLift using their API.

    so to sum up In editor, everything works fine.

    When I build for IOS, if link.xml contains a line for log4net I get the above error, and the app doesn't even boot.
    When I delete that line in link.xml, the app boots, but then crashes when calling GameLiftAPI.

    What could be causing it to work perfectly in editor but not in IOS? How do I even go about debugging this.
     
  3. kheldorin

    kheldorin

    Joined:
    May 28, 2015
    Posts:
    22
  4. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    164
    How do I figure out what code is being stripped though. I’m really having trouble with this.
     
  5. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    164
    Update: I managed to solve this issue with much difficulty. Here are the steps I did to fix it. in case anyone else has problems

    1) Make sure I had updated AWS SDK dlls. I got these with nuget in rider, then dragged the netstandard2.0 dll into the plugins folder. Note: Look very carefully at the dependencies listed in nuget. I had to use a slightly older version the AWS SDK to be compatible with the cognitoAuthentification.dll.

    2) Use Amazon.Extensions.CognitoAuthentication.dll and NOT AWSSDK.Extensions.CognitoAuthentication.dll

    3) Delete everything in link.xml file. Only include the following entry:

    Code (CSharp):
    1. <linker>
    2.     <assembly fullname="AWSSDK.Core">
    3.         <type fullname="Amazon.Util.Internal.PlatformServices.NetworkReachability" preserve="all"/>
    4.         <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
    5.     </assembly>
    6. </linker>
    4) Go through ALL the other plugins, and checking exclude iOS, one by one. First, check if it breaks desktop play in editor. Then check if it breaks anything in iOS build. I think this might have been the most important step.

    Note every single time I changed dlls in unity plugins folder, I had to reboot unity to get rid of console errors and failure to reload scripts.
     
  6. justin_sunblink

    justin_sunblink

    Joined:
    Dec 3, 2019
    Posts:
    18
    I've ran into this issue trying to integrate the GameLift SDK. My solution has been to:
    • Use the uni4log wrapper, but see my created issue that includes an updated version of the log4net.dll that is further stripped
    • Add `log4net` and `log4uni` to link.xml and preserve 'all'
    • Hack in a custom log4uni configurator that restores regular Unity logging (because I hate log4net with a passion).
    This works on my IL2CPP build of my headless Linux server.
     
  7. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    882
    This as nothing to do with NetCode. I would suggest to post that on the general dots forum instead, for larger visibility.
     
  8. justin_sunblink

    justin_sunblink

    Joined:
    Dec 3, 2019
    Posts:
    18
    It's relevant, if you try and use the AWS GameLift service to host your dedicated server DOTS game, you will get this error.
     
  9. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    882
    That is not what I meant.. I understood that is because you want to host your server on Gamelift, but given where it is failing, and how, seems not just dots-netcode but something more general.
     
    desertGhost_ likes this.