Skip to content

Commit 17b738e

Browse files
committed
Merge branch 'chore/optimize-network-object' of github.com:Unity-Technologies/com.unity.netcode.gameobjects into chore/optimize-network-object
2 parents 084f7c3 + b6e2264 commit 17b738e

File tree

3 files changed

+56
-18
lines changed

3 files changed

+56
-18
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,29 @@ Additional documentation and release notes are available at [Multiplayer Documen
1010

1111
### Added
1212

13+
14+
### Changed
15+
16+
17+
### Deprecated
18+
19+
20+
### Removed
21+
22+
23+
### Fixed
24+
25+
26+
### Security
27+
28+
29+
### Obsolete
30+
31+
32+
## [2.8.0] - 2025-12-15
33+
34+
### Added
35+
1336
- It is now possible to control which port clients will bind to using the `UnityTransport.ConnectionData.ClientBindPort` field. If not set, clients will bind to an ephemeral port (same as before this change). (#3764)
1437
- Added a flag to override command-line arguments (port and ip) in `SetConnectionData`. (#3760)
1538
- Added a command-line singleton to parse environment command-line arguments. (#3760)
@@ -26,12 +49,6 @@ Additional documentation and release notes are available at [Multiplayer Documen
2649
- Improve performance of `NetworkTransformState`. (#3770)
2750
- Changed NetworkAnimator to use the `RpcAttribute` along with the appropriate `SendTo` parameter. (#3586)
2851

29-
### Deprecated
30-
31-
32-
### Removed
33-
34-
3552
### Fixed
3653

3754
- Ensure `NetworkBehaviour.IsSessionOwner` is correctly set when a new session owner is promoted. (#3817)
@@ -44,12 +61,6 @@ Additional documentation and release notes are available at [Multiplayer Documen
4461
- Fixed issue where using the dedicated server package would override all attempts to change the port by code. (#3760)
4562
- Fixed issue with authority animator instance sending itself RPCs. (#3586)
4663

47-
### Security
48-
49-
50-
### Obsolete
51-
52-
5364
## [2.7.0] - 2025-10-27
5465

5566
### Added

com.unity.netcode.gameobjects/Runtime/Components/NetworkAnimator.cs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private void FlushMessages()
7878
private bool HasAuthority()
7979
{
8080
var isServerAuthority = m_NetworkAnimator.IsServerAuthoritative();
81-
return (!isServerAuthority && m_NetworkAnimator.IsOwner) || (isServerAuthority && (m_NetworkAnimator.IsServer || m_NetworkAnimator.IsOwner));
81+
return (!isServerAuthority && m_NetworkAnimator.IsOwner) || (isServerAuthority && (m_NetworkAnimator.IsServer));
8282
}
8383

8484
/// <inheritdoc />
@@ -95,7 +95,8 @@ public void NetworkUpdate(NetworkUpdateStage updateStage)
9595

9696
var hasAuthority = HasAuthority();
9797
// Only the authority or the server will send messages
98-
if (hasAuthority || m_IsServer)
98+
// The only exception is server authoritative and owners that are sending animation triggers.
99+
if (hasAuthority || m_IsServer || (m_NetworkAnimator.IsServerAuthoritative() && m_NetworkAnimator.IsOwner))
99100
{
100101
// Flush any pending messages
101102
FlushMessages();
@@ -408,7 +409,18 @@ private void BuildTransitionStateInfoList()
408409
}
409410

410411
TransitionStateInfoList = new List<TransitionStateinfo>();
411-
var animatorController = m_Animator.runtimeAnimatorController as AnimatorController;
412+
var animControllerType = m_Animator.runtimeAnimatorController.GetType();
413+
var animatorController = (AnimatorController)null;
414+
415+
if (animControllerType == typeof(AnimatorOverrideController))
416+
{
417+
animatorController = ((AnimatorOverrideController)m_Animator.runtimeAnimatorController).runtimeAnimatorController as AnimatorController;
418+
}
419+
else if (animControllerType == typeof(AnimatorController))
420+
{
421+
animatorController = m_Animator.runtimeAnimatorController as AnimatorController;
422+
}
423+
412424
if (animatorController == null)
413425
{
414426
return;
@@ -432,7 +444,22 @@ internal void ProcessParameterEntries()
432444
return;
433445
}
434446

435-
var parameters = Animator.parameters;
447+
var animControllerType = m_Animator.runtimeAnimatorController.GetType();
448+
var animatorController = (AnimatorController)null;
449+
450+
if (animControllerType == typeof(AnimatorOverrideController))
451+
{
452+
animatorController = ((AnimatorOverrideController)m_Animator.runtimeAnimatorController).runtimeAnimatorController as AnimatorController;
453+
}
454+
else if (animControllerType == typeof(AnimatorController))
455+
{
456+
animatorController = m_Animator.runtimeAnimatorController as AnimatorController;
457+
}
458+
if (animatorController == null)
459+
{
460+
return;
461+
}
462+
var parameters = animatorController.parameters;
436463

437464
var parametersToRemove = new List<AnimatorParameterEntry>();
438465
ParameterToNameLookup.Clear();

com.unity.netcode.gameobjects/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.unity.netcode.gameobjects",
33
"displayName": "Netcode for GameObjects",
44
"description": "Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.",
5-
"version": "2.8.0",
5+
"version": "2.8.1",
66
"unity": "6000.0",
77
"dependencies": {
88
"com.unity.nuget.mono-cecil": "1.11.4",
@@ -15,4 +15,4 @@
1515
"path": "Samples~/Bootstrap"
1616
}
1717
]
18-
}
18+
}

0 commit comments

Comments
 (0)