Skip to content

feat: hybrid and NGO spawn counts in editor analytics - #4205

Open
NoelStephensUnity wants to merge 5 commits into
develop-3.x.xfrom
feat/hybrid-spawn-analytics
Open

NoelStephensUnity wants to merge 5 commits into
develop-3.x.xfrom
feat/hybrid-spawn-analytics

Conversation

@NoelStephensUnity

Copy link
Copy Markdown
Member

Purpose of this PR

The NGO_NetworkManager editor analytics event now reports how many hybrid (NGO + N4E) instances were spawned in each session compared with normal NGO instances, and whether the session ran in hybrid mode.

Three fields are added to the event:

  • NgoSpawnCount: instances without a GhostObject spawned during the session.
  • HybridSpawnCount: hybrid instances spawned during the session.
  • HybridSession: true when the session started with hybrid prefabs registered, so a hybrid session that spawned no hybrid instances can still be identified.

Each NetworkManager start is its own session, so a play mode with several sessions sends one event per session. The counts are taken on the local peer: a host counts every spawn, a client counts the spawns it received, and an object that is despawned and spawned again counts each time. The counters exist in the editor only.

The event stays at version 5. The new fields were added to the existing schema as nullable columns, so events from earlier package versions still arrive with them empty.

(Once #4202 lands, a session can no longer report hybrid spawns with HybridSession false, since those spawns are refused)

Jira ticket

None.

Changelog

None: editor analytics only.

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: in-editor host sessions with and without hybrid prefabs, including sessions with no hybrid and no NGO spawns; every event arrived in the analytics backend with the expected values.

Automated tests:

  • Covered by new automated tests: SpawnCountAnalyticsTests.SpawnsAreCountedOnEveryPeer (Host and UnifiedHost)

Up-port

Not needed: this targets develop-3.x.x.

Backports

None.

NetworkSpawnManager counts local spawns (editor only) and the hybrid ones
among them. NetcodeAnalytics reads both when the session stops and adds
NgoSpawnCount and HybridSpawnCount to the NGO_NetworkManager event.
HybridSession is true when the session started with hybrid prefabs
registered, so a hybrid session that spawned no hybrid instances is still
identifiable.
@NoelStephensUnity
NoelStephensUnity requested a review from a team as a code owner October 20, 2026 22:09

@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

Needs changes

The per-peer counters and shutdown capture align with the session lifecycle; I also examined the event payload and conditional test setup.

Reviewed commit b461ed1

🤖 Helpful? 👍/👎

@codecov-github-com

codecov-github-com Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
...ameobjects/Runtime/Spawning/NetworkSpawnManager.cs 50.00% 1 Missing ⚠️
@@                Coverage Diff                @@
##           develop-3.x.x    #4205      +/-   ##
=================================================
- Coverage          76.03%   76.03%   -0.01%     
=================================================
  Files                159      159              
  Lines              27344    27346       +2     
=================================================
+ Hits               20791    20792       +1     
- Misses              6553     6554       +1     
Flag Coverage Δ
NGOv2_project_testproject_ubuntu 75.09% <50.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...ameobjects/Runtime/Spawning/NetworkSpawnManager.cs 72.51% <50.00%> (-0.04%) ⬇️
Components Coverage Δ
com.unity.netcode.gameobjects 76.03% <50.00%> (-0.01%) ⬇️

ℹ️ Need help interpreting these results?

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