Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Unity Transport : Failed to initialize the Network Interface. Error Code -1.

Discussion in 'Unity Transport' started by Kartikaeya, May 4, 2021.

  1. Kartikaeya


    Jan 3, 2021
    So I'm making a mobile VR game where the user will put on some google cardboard like device and would control the character movement through the keyboard on a laptop/computer which is on the same wifi network as the mobile.

    The way this is set up is that I have two different scenes, the controller scene(client) which runs on the computer and the scene containing the actual game(server) which runs on the mobile device in VR. Whenever there is a keyboard event on the computer the controller scene sends a network message to the main game scene on the mobile device, thus controlling the character movements.

    To send these network messages I've used the Unity transport package, and have used almost the exact script available here.
    The game runs fine when I build both the controller and the game (client & server) on pc i.e I'm able to control the character in the game scene from the controller scene. But it fails when either of the client or the server is built to the mobile device. I get these two errors on the mobile device :

    1. InvalidOperationException: Failed to initialize the NetworkInterface. Error Code: -1.
    2. Error on receive, errorCode = 16777219

    I am new to networking (and unity in general) so I'm sorry for taking your time if this turns out to be a noob mistake.
    Thanks a lot for your help in advance!
  2. justin_sunblink


    Dec 3, 2019
    I have run into this error when attempting to bind my server to a public IP address assigned by AWS GameLift. When I switched to using the `AnyIpv4` endpoint type, things started working.
    Kartikaeya and luke-unity like this.
  3. Kartikaeya


    Jan 3, 2021
  4. Endlesser


    Nov 11, 2015
    Bump into this error when upgrading Unity from 2020.3.6f1 to 2020.3.36f1. Transport package is 0.6.0-preview.7.

    In DriverSys.cs:469 is 'var drv = NetworkDriver.Create();'

    nvalidOperationException: Failed to initialize the NetworkInterface. Error Code: -1.
    Unity.Networking.Transport.NetworkDriver..ctor (Unity.Networking.Transport.INetworkInterface netIf, Unity.Networking.Transport.INetworkParameter[] param) (at Library/PackageCache/com.unity.transport@0.6.0-preview.7/Runtime/NetworkDriver.cs:565)
    Unity.Networking.Transport.NetworkDriver.Create (Unity.Networking.Transport.INetworkParameter[] param) (at Library/PackageCache/com.unity.transport@0.6.0-preview.7/Runtime/NetworkDriver.cs:483)
    ProjDagon.ECS.Transport.DriverSys.OnUpdate () (at Assets/Scripts/Systems/Transport/DriverSys.cs:469)
    Unity.Entities.SystemBase.Update () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/SystemBase.cs:412)
    Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ComponentSystemGroup.cs:472)
    Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Stubs/Unity/Debug.cs:19)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ComponentSystemGroup.cs:477)
    Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ComponentSystemGroup.cs:423)
    Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ComponentSystem.cs:114)
    Latios.SuperSystem:UpdateManagedSystem(ComponentSystemBase) (at Library/PackageCache/com.latios.latiosframework@0.4.4/Core/Core/Framework/SuperSystem.cs:123)
    Latios.SuperSystem:UpdateAllManagedSystems(ComponentSystemGroup) (at Library/PackageCache/com.latios.latiosframework@0.4.4/Core/Core/Framework/SuperSystem.cs:136)
    Latios.Systems.LatiosSimulationSystemGroup:OnUpdate() (at Library/PackageCache/com.latios.latiosframework@0.4.4/Core/Core/Framework/LatiosWorld.cs:282)
    Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ComponentSystem.cs:114)
    Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ScriptBehaviourUpdateOrder.cs:333)