Skip to content

Commit

Permalink
Fixed blocks not being destroyed on new/load program
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofarias committed Mar 9, 2023
1 parent 1174927 commit 057a04f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Assets/Scripts/ModuleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public void Reset()
Modules.Clear();
ActiveModule = null;
_nodesToModules.Clear();

// The game only destroys active gameobjects. We need to destroy the inactive ones ourselves
foreach (BlockElementScript block in _vizzyController.ProgramTransform.GetComponentsInChildren<BlockElementScript>(true))
{
block.Destroy();
}
}

public bool CanRenderNode(ProgramNode node)
Expand Down

0 comments on commit 057a04f

Please sign in to comment.