#Hybrid ECS Scene Management?
1 messages · Page 1 of 1 (latest)
You can just manually load subscenes
And unload them
tie them to monob lifecycle for example
Are subscenes not automatically loaded and unloaded via the lifecycle of their parent scene?
They are loaded through monob of subscene
Only if you have it checked
I'm not sure if that is true. From what I'm looking at right now, the subscene is loaded in play mode regardless if it is checked in the Hierarchy. The difference between checked and unchecked as far as I can discern is whether Entities Hierarchy shows the subscene as 'closed' (but still populated with 'Entity (##:#)'), or when checked, the subscene is shown as 'Live Converted' with human readable names.
well yes, while it's true, they do register to default world. You can also load them by guid
which will also create subscene entity
that entity at the same time can have any state
While just allowing the Unity scene manage the subscene seems to give me the behavior I want, although with
System.ArgumentException: All entities passed to EntityManager must exist. One of the entities has already been destroyed or was never created.
when switching from my ECS scene to my Mono-only frontend (maybe an inflight ECB straddling the unload). I seem to be getting brutal performance drops after the 2nd time loading the ECS scene. So I am guessing something isn't being cleaned up nicely.
I need to investigate further.
Looks like the spikes are listed under 'Others' in CPU Usage. And are manifesting as the EditorLoop taking an extra 20ms~. The odd thing is I can't seem to spot any actual information in the profiler that might point to what it is other than 'Others'.
Additional note:
Manually loading and unloading the subscene like described in https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/streaming-loading-scenes.html doesn't seem to help.
Manually destroying and recreating the default world line mentioned in https://forum.unity.com/threads/shutdown-ecs-scene-switching.937481/ doesn't seem to help.
I'm probably missing the 'Unity approved' way to load between two different Unity scenes that have ECS as of 1.0. Surprisingly non-obvious.
I'm seeing no lag spikes when loading into the ECS scene the first time, but the second time I'm seeing large spikes. By "doesn't help" I meant those manual ways of unloading the scene do no fix whatever is causing the game breaking spikes (i.e. seemingly no better than just SceneManager.LoadScene()). My current suspicion is that it might be physics or culling related, specifically some state being carried over between scenes regardless of unloads.
When spike happens?
SceneManager.LoadScene() is sync verison which causes spikes afaik
and you want Async
you can't async load non-ecs scenes in the editor
Sorry. To be more specific, by lag spikes I mean frequent, multiple times per second stuttering. As shown on the profile photo above. I am fine with blocking scene loads at this point.
do you have any entities-related editor windows open?
I have Systems window etc tabbed on a pane, but not visible. I'll try closing all ECS related windows.
if closing teh ecs windows fixes it, that's a bug we should fix; if it doesn't fix it, i probably need to look at your project with superluminal to figure out what the editor is doing in those 14ms
the hierarchy view might have something, though
shouldn't be
I did async loading between normal scenes
while recreating world from scratch
no stutters
Unfortunately, doesn't look like the ECS windows are causing it. I confirmed all instantiated entities are appropriated scene tagged. And none seem to be hanging around between scenes.
how big is your project? uploadable in a bug?
Only 50mb. Ya I should be able to upload it in a bug.
awesome; be sure to post the number back here when you get one or i might miss it