How to update new World

Hi, sorry for my bad english.

I’m disable auto bootstrap and create new world:

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    static void Init()
    {
        World myWolrd = new World("tewst world");
        World.Active = myWolrd;
        manager = World.Active.GetOrCreateSystem<EntityManager>();
        World.Active.GetOrCreateSystem<CoinsIncrementJobSystem>();
    }

But my “CoinsIncrementJobSystem” don’t update.

What I need to do for my “CoinsIncrementJobSystem” update automaticly?

And second question:

How disable auto creation system in default world on startup, and add this system in any time, when I needed?

Your systems should be in player loop, for player loop there is should be 3 root groups - Initialization, Simulation, Presentation, and your system should be inside one of this group.

using Unity.Entities;
using Unity.Jobs;
using UnityEngine;

public class WithoutDefaultWorld
{
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    static void RunSystems()
    {
        Debug.Log("I'm tired, let's create better world!");
        var world = new World("New Better World");
        World.Active = world;
       
        PlayerLoopManager.RegisterDomainUnload (DomainUnloadShutdown, 10000);
       
        var initGroup = world.CreateSystem<InitializationSystemGroup>();
        var simGroup = world.CreateSystem<SimulationSystemGroup>();
        var presGroup = world.CreateSystem<PresentationSystemGroup>();
       
        var superSystem = world.CreateSystem<MysSuperSystem>();
        simGroup.AddSystemToUpdateList(superSystem);
        simGroup.SortSystemUpdateList();
       
        ScriptBehaviourUpdateOrder.UpdatePlayerLoop(world);
    }
   
    static void DomainUnloadShutdown()
    {
        World.DisposeAllWorlds();
        ScriptBehaviourUpdateOrder.UpdatePlayerLoop(World.Active);
    }
}

public class MysSuperSystem : JobComponentSystem
{
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        Debug.Log("Super Update!");
        return inputDeps;
    }
}

1 Like