diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/GlobalWorldFactory.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/GlobalWorldFactory.cs index d7f8e5bcad2..6e350cbb06d 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/GlobalWorldFactory.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/GlobalWorldFactory.cs @@ -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), diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSReloadScene.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSReloadScene.cs index 9d48dcfca39..6fe7d12e7c6 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSReloadScene.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSReloadScene.cs @@ -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; @@ -93,8 +91,9 @@ private async UniTask DisposeAndRestartAsync(Entity entity, ISceneFacade current if (localSceneDevelopment) { - world.Query(in new QueryDescription().WithAll(), - (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 diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Systems/UnloadSceneSystem.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Systems/UnloadSceneSystem.cs index 74dfe640526..fea263e9a95 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Systems/UnloadSceneSystem.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Systems/UnloadSceneSystem.cs @@ -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) @@ -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, 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, DeleteEntityIntention>(entity); } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Tests/UnloadSceneSystemShould.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Tests/UnloadSceneSystemShould.cs index e4085d85806..d5c4b11d755 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Tests/UnloadSceneSystemShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Tests/UnloadSceneSystemShould.cs @@ -15,7 +15,7 @@ public class UnloadSceneSystemShould : UnitySystemTestBase [SetUp] public void SetUp() { - system = new UnloadSceneSystem(world, Substitute.For(), false); + system = new UnloadSceneSystem(world, Substitute.For()); } [Test]