In the last commit, we focused on the EnemyMovement class and some changes were introduced to handle unsubscribing enemies objects from GameManager 'OnModeChange' event, with the intuit of avoiding memory leaks or the garbage collector running unexpectedly.
Testing the solution, we discovered that making the object unsubscribe itself from the event throws a null reference error.
The solution found was to execute this action on the EnemyManager class and inside the ResetStart method, just before the enemies objects are disabled.
The implementation needs to be polished and applied to Survival mode , taking in consideration the new instantiated objects.
Reference:
|
GM.OnModeChange -= EM.UpdateRadius; |
In the last commit, we focused on the EnemyMovement class and some changes were introduced to handle unsubscribing enemies objects from GameManager 'OnModeChange' event, with the intuit of avoiding memory leaks or the garbage collector running unexpectedly.
Testing the solution, we discovered that making the object unsubscribe itself from the event throws a null reference error.
2Hard/Assets/Scripts/EnemyMovement.cs
Line 42 in ad8449f
The solution found was to execute this action on the EnemyManager class and inside the ResetStart method, just before the enemies objects are disabled.
The implementation needs to be polished and applied to Survival mode , taking in consideration the new instantiated objects.
Reference:
2Hard/Assets/Scripts/EnemyManager.cs
Line 134 in ad8449f