DOTS Editor Systems window isn't showing any systems in my custom off-main-thread world

Unity 2021.2.7f1; Unity.Entities 0.17.0-preview.42; Unity.DOTS Editor 0.12.0-preview.6. I’m working on a game where I run a separate thread to handle all match state processing, because rendering is really slow here and I want to avoid as much main-thread activity as possible. I create an ECS World in the main thread, and then loop in a separate thread to SetTime and Update it manually.

When the world is running, it appears in the Systems and Entities editor tabs / windows’ world selection dropdowns. The Entities window successfully shows all entities and their components as they appear. However, the Systems window shows the world as though it has no systems at all. If I change it to Show Full Player Loop then I can see all of the basic player loop systems, so it seems that only my world is being affected.

I’ve subclassed World and add systems to it in the constructor. It’s being instantiated on the main thread. This is what the constructor looks like:

    public class MatchStateProcessorWorld : World
    {
        public MatchStateProcessorWorld(MatchState initialState) : base("FrankenStorm Match State Processor World")
        {
            var delta = initialState.time == 0 ? 0f : (float)MatchStateProcessor.TICK_TIME;
            SetTime(new Unity.Core.TimeData(initialState.time, delta));

            var sysGroup = CreateSystem<SimulationSystemGroup>();
            sysGroup.AddSystemToUpdateList(CreateSystem<SpawnSystem>());
        }
    }

Is there something else I need to do to have these systems appear in the editor window, or is there something wrong with my approach here?

An unfortunate update on this sitch: there were other instabilities and frequent crashes occurring, with mostly incomprehensible (by me at least) logs. I tried removing the DOTS Editor package and then things smoothed out nicely. So I’ll be leaving it off for a while - seems like this package assumes main-thread operation for now?

Hmm unfortunately I’ll be giving up on running the world from another thread Lots of problems where things in the Entities package are hardcoded to use Allocator.Temp which doesn’t work, see this error:

ArgumentException: Could not allocate native memory. If this allocation was made from a managed thread outside of a job, you must use Allocator.Persistent or Allocator.TempJob.

e.g. even using EntityCommandBuffers has this occur.

Curiously this problem is still occurring with everything moved back onto the main thread. I am still using a custom world though, not the ones Unity bootstraps itself, as I’ve got save/load functionality hooked up nice and easily this way.

I wonder what I’m missing o.O

It’s been a while since I look at the reasoning but if I recall either you need to force add it to the playerloop or maybe even only updates from the default world will appear in here.

The trick that packages like netcode and we use at work is we update custom worlds from a system in the default world - this causes everything to appear nicely in the inspector.

Ohhh interesting! So the two worlds exist beside each other, you write systems which are automatically hooked up to the default world, and in those systems you explicitly reference your IndependentWorld.EntityManager and such instead of what the system would’ve defaulted to?

No. You just create 2+ worlds but you simply call World2 [InitializationSystemGroup|SimulationSystemGroup|PresentationSystemGroup].Update from a system in World1

1 Like

So im trying to achieve this on the new 1.0 version, but it doesnt work.
I create a emtpy world in bootstrap with my “worldupdater” system and append this world to the playerloop like normal.
I then create a new world in the worldupdater.oncreate, and do world.update in its onupdate.

The systemswindow shows my world as completely empty however.
(it does give nice info about the default world though, the one with only 1 system)

So it looks like:

  • Defaultworld

  • Simulationgroup

  • MyVariablerategroup

  • MyWorldSystem (this owns the world im interested in)

  • MyWorld.Update() (this world actually contains the logic i want to see in the editor)

If this is no longer possible with this method, is there any other way to make the editors work with custom stepped worlds?

In this thread you see a simple ICustomBootstrap that results in both worlds nicely showing all added systems in the editor (Systems Window). The important call for that is ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop(anotherWorld);
The issue I am having is that all Singletons providing access to the unmanaged EntityCommandBufferSystems end up in the Default World, and not in world I like to have them in…

1 Like