Skip to content

Commit

Permalink
Simplifies UnityInjector
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavopsantos committed Dec 19, 2023
1 parent 8c3b9da commit 086dab8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Assets/Reflex/Injectors/UnityInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ void InjectScene(Scene scene, LoadSceneMode mode = default)
void DisposeScene(Scene scene)
{
ReflexLogger.Log($"Scene {scene.name} ({scene.GetHashCode()}) unloaded", LogLevel.Development);
var sceneContainer = containersByScene[scene];
containersByScene.Remove(scene);
containersByScene.Remove(scene, out var sceneContainer);
sceneContainer.Dispose();
}

Expand Down Expand Up @@ -86,9 +85,8 @@ private static Container CreateSceneContainer(Scene scene, Container projectCont
{
builder.SetName($"{scene.name} ({scene.GetHashCode()})");

if (ScenePreInstaller.TryGetValue(scene, out var preInstaller))
if (ScenePreInstaller.Remove(scene, out var preInstaller))
{
ScenePreInstaller.Remove(scene);
preInstaller.Invoke(builder);
}

Expand Down

0 comments on commit 086dab8

Please sign in to comment.