Skip to content

Null Reference being throw when unsubscribing UpdateRadius from OnModeChange. #1

@dougwl

Description

@dougwl

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.

// void OnDisable(){

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;

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions