Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public GlobalWorld Create(ISceneFactory sceneFactory, Entity playerEntity)

var finalizeWorldSystems = new IFinalizeWorldSystem[]
{
UnloadSceneSystem.InjectToWorld(ref builder, scenesCache, localSceneDevelopment),
UnloadSceneSystem.InjectToWorld(ref builder, scenesCache),
UnloadSceneLODSystem.InjectToWorld(ref builder, scenesCache, lodCache, staticContainer.RealmPartitionSettings),
UnloadRoadSystem.InjectToWorld(ref builder, roadAssetPool, scenesCache),
new ReleaseRealmPooledComponentSystem(componentPoolsRegistry),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
using DCL.Character.Components;
using DCL.ResourcesUnloading;
using ECS.LifeCycle.Components;
using ECS.SceneLifeCycle.Components;
using ECS.SceneLifeCycle.IncreasingRadius;
using ECS.SceneLifeCycle.SceneDefinition;
using ECS.StreamableLoading.Common;
using SceneRunner.Scene;
using System.Threading;
using UnityEngine;
Expand Down Expand Up @@ -93,8 +91,9 @@ private async UniTask DisposeAndRestartAsync(Entity entity, ISceneFacade current

if (localSceneDevelopment)
{
world.Query(in new QueryDescription().WithAll<RealmComponent>(),
(ref StaticScenePointers staticScenePointers) => { staticScenePointers.Promise = null; });
// No definition re-discovery here: the kept definition entity stays valid across
// file edits because LSD content hashes are path-derived. Added/removed files are
// not reflected until the realm is re-entered.

// Force-drain dereferenced caches on LSD reload. The local dev server derives hashes
// from the file path, not content, so an updated model keeps the same hash and cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ namespace ECS.SceneLifeCycle.Systems
public partial class UnloadSceneSystem : BaseUnityLoopSystem, IFinalizeWorldSystem
{
private readonly IScenesCache scenesCache;
private readonly bool localSceneDevelopment;

internal UnloadSceneSystem(World world, IScenesCache scenesCache, bool localSceneDevelopment) : base(world)
internal UnloadSceneSystem(World world, IScenesCache scenesCache) : base(world)
{
this.scenesCache = scenesCache;
this.localSceneDevelopment = localSceneDevelopment;
}

protected override void Update(float t)
Expand Down Expand Up @@ -104,9 +102,11 @@ private void UnloadLoadedScene(in Entity entity, ref SceneDefinitionComponent de
ReportHub.LogProductionInfo($"Scene '{definitionComponent.Definition?.GetLogSceneName()}' disposed");
ReportHub.Log(ReportCategory.SCENE_LOADING, $"UnloadSceneSystem: UnloadLoadedScene '{definitionComponent.Definition?.GetLogSceneName()}'");

// Keep definition so it won't be downloaded again = Cache in ECS itself
if (!localSceneDevelopment)
World.Remove<ISceneFacade, AssetPromise<ISceneFacade, GetSceneFacadeIntention>, DeleteEntityIntention>(entity);
// Keep definition so it won't be downloaded again = Cache in ECS itself.
// This includes local scene development: its content hashes are path-derived, so the
// definition stays valid across file edits and the kept entity lets
// ResolveStaticPointersSystem recreate the facade promise on reload without re-discovery.
World.Remove<ISceneFacade, AssetPromise<ISceneFacade, GetSceneFacadeIntention>, DeleteEntityIntention>(entity);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class UnloadSceneSystemShould : UnitySystemTestBase<UnloadSceneSystem>
[SetUp]
public void SetUp()
{
system = new UnloadSceneSystem(world, Substitute.For<IScenesCache>(), false);
system = new UnloadSceneSystem(world, Substitute.For<IScenesCache>());
}

[Test]
Expand Down
Loading