Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug IL2CPP No server world in build

Discussion in 'NetCode for ECS' started by l33t_P4j33t, Dec 14, 2021.

  1. l33t_P4j33t


    Jul 29, 2019
    in il2cpp, there is no server world created
    ie. calling this
    Code (CSharp):
    1. for (int i = 0; i < World.All.Count; i++) {
    2.     var world = World.All[i];
    3.     if (world.GetExistingSystem<ServerSimulationSystemGroup>() != null) {
    4.         return world;
    5.     }
    6. }
    8. Debug.LogError($"no server world, count: {World.All.Count}");
    9. return null;
    cannot find the world. (called from a monobehaviour start method)
    no other error is given or reason as to why it fail to initialize
    not sure what to do or how to debug the problem
    Last edited: Dec 14, 2021
  2. timjohansson


    Unity Technologies

    Jul 13, 2016
    There is a bug in netcode 0.6 where the bootstrap can be stripped in some build configurations because it is missing the `Preserve` attribute. Not sure if that is causing this specific issue, but if it is you should be able to work around it by adding something like this to your project
    Code (CSharp):
    1. [UnityEngine.Scripting.Preserve]
    2. public class MyCustomNetCodeBootstrap : ClientServerBootstrap
    3. {
    4.     public override bool Initialize(string defaultWorldName)
    5.     {
    6.         return base.Initialize(defaultWorldName);
    7.     }
    8. }
    Or just add that preserve attribute to your existing custom bootstrap instead if you have one.
    Opeth001 likes this.