Skip to content

fix: handle NetworkManager Awake being overridden - #4237

Open
EmandM wants to merge 1 commit into
develop-2.0.0from
fix/override-networkmanager-awake
Open

EmandM wants to merge 1 commit into
develop-2.0.0from
fix/override-networkmanager-awake

Conversation

@EmandM

@EmandM EmandM commented Nov 2, 2026

Copy link
Copy Markdown
Member

Purpose of this PR

Ensure required NetworkManager methods are protected virtual so the base versions can be called when overridden.

Jira ticket

UUM-159597

Changelog

  • Fixed: Resolves exceptions being thrown when a derived NetworkManager implements their own Awake.

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does the change require QA team to:

  • Review automated tests?
  • Execute manual tests?
  • Provide feedback about the PR?

If any boxes above are checked the QA team will be automatically added as a PR reviewer.

Up-port

Needs up-port

Backports

n/a

@EmandM
EmandM requested a review from a team as a code owner November 2, 2026 17:34

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

LGTM

The logger fallbacks consistently cover all three startup modes, and the lifecycle methods now allow derived managers to invoke their base implementations.

Reviewed commit e6693e9

🤖 Helpful? 👍/👎


// Note that this gets also called manually by OnSceneUnloaded and OnApplicationQuit
private void OnDestroy()
protected virtual void OnDestroy()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2

A future OnDestroy override that disposes a native allocation can dispose it twice when a listening derived manager quits. OnApplicationQuit manually calls OnDestroy, which now dispatches to the override. Unity also invokes OnDestroy when destroying the active component. Previously, the manual call reached only NetworkManager's private implementation. Extract the manual shutdown work into a private method. Call that method from OnApplicationQuit and OnSceneUnloaded. Reserve virtual OnDestroy for Unity's destruction callback.

🤖 Helpful? 👍/👎

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant