Skip to content

fix: only warn about pre-session hybrid instances - #4245

Open
NoelStephensUnity wants to merge 2 commits into
develop-3.x.xfrom
fix/hybrid-not-registered-warning-spam
Open

NoelStephensUnity wants to merge 2 commits into
develop-3.x.xfrom
fix/hybrid-not-registered-warning-spam

Conversation

@NoelStephensUnity

Copy link
Copy Markdown
Member

Purpose of this PR

With NetworkManager.LogLevel set to Developer, every NetworkObject that started before a session logged "Did not register because there is no session in progress!", hybrid or not. A scene with only plain in-scene placed NetworkObjects spammed it on entering play mode.

The warning exists to tell users that a hybrid instance created before a session starts (for example a pooled instance) is not supported and will not be registered. NetworkObject.InitGhost checked whether a session was in progress before it checked whether the instance has a GhostObject. It now early-exits for non-hybrid instances and hybrid prefabs first, so only a pre-session hybrid instance logs the warning. The warning also names the instance now.

PR Scope:

  • NetworkObject.InitGhost check order.
  • The warning names the instance.

Out of scope:

  • Supporting hybrid instances created before a session starts (pooled hybrid instances remain unsupported; in-scene placed hybrid instances are already rejected in the editor).

Jira ticket

N/A

Changelog

  • Fixed: Issue where every NetworkObject that started before a session logged a "Did not register because there is no session in progress!" warning when NetworkManager.LogLevel was Developer. Only GhostObject instances log it now.

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

UnifiedHybridPrefabValidationTests.PreSessionInstanceWarnsOnlyWhenHybrid: a non-hybrid instance with developer logging and a hybrid instance with normal logging do not warn; a hybrid instance with developer logging warns once, naming the instance.

Does the change require QA team to:

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

Up-port

N/A (develop-3.x.x only; develop-2.0.0 has no hybrid mode)

Backports

N/A

InitGhost checked IsListening before checking whether the instance has a
GhostObject, so with developer logging every NetworkObject started before
a session logged the not registered warning. The warning now names the
instance.
@NoelStephensUnity
NoelStephensUnity requested a review from a team as a code owner November 6, 2026 23:13

@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

Ship it

The change limits pre-session registration warnings to hybrid instances and adds the instance name. I reviewed the guard ordering, serialized hybrid state, regression test setup and log capture, and changelog; no actionable issues were found.

Reviewed commit ce5ffd7

🤖 Helpful? 👍/👎

@codecov-github-com

codecov-github-com Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
....netcode.gameobjects/Runtime/Core/NetworkObject.cs 75.00% 1 Missing ⚠️
@@                Coverage Diff                @@
##           develop-3.x.x    #4245      +/-   ##
=================================================
- Coverage          76.74%   76.73%   -0.02%     
=================================================
  Files                159      159              
  Lines              28078    28078              
=================================================
- Hits               21549    21546       -3     
- Misses              6529     6532       +3     
Flag Coverage Δ
NGOv2_project_testproject_ubuntu 75.77% <75.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
....netcode.gameobjects/Runtime/Core/NetworkObject.cs 71.23% <75.00%> (-0.20%) ⬇️

... and 1 file with indirect coverage changes

Components Coverage Δ
com.unity.netcode.gameobjects 76.73% <75.00%> (-0.02%) ⬇️

ℹ️ Need help interpreting these results?

@NoelStephensUnity
NoelStephensUnity enabled auto-merge (squash) November 7, 2026 00:18

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