Skip to content

Commit 7f5d62a

Browse files
committed
Merge branch 'develop-2.0.0' into chore/optimize-destroy-object-message
# Conflicts: # com.unity.netcode.gameobjects/CHANGELOG.md
2 parents e7fe265 + b37d121 commit 7f5d62a

21 files changed

+1368
-250
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ Additional documentation and release notes are available at [Multiplayer Documen
1313
- 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)
1414
- Added a flag to override command-line arguments (port and ip) in `SetConnectionData`. (#3760)
1515
- Added a command-line singleton to parse environment command-line arguments. (#3760)
16-
16+
- Added `NetworkAnimator.AuthorityMode` which allows you to select whether the `NetworkAnimator` will use a server or owner authority model for state updates (like `NetworkTransform`). (#3586)
17+
- Added the ability to select which `Animator` parameters the authority `NetworkAnimator` instance should synchronize. This can be done via the inspector view interface or during runtime via `NetworkAnimator.EnableParameterSynchronization`. (#3586)
1718

1819
### Changed
1920

2021
- Improve performance of `DestroyObjectMessage`. (#3801)
22+
- Changed NetworkAnimator to use the `RpcAttribute` along with the appropriate `SendTo` parameter. (#3586)
2123
- Improve performance of `NetworkTransformState`. (#3770)
2224

2325

@@ -33,6 +35,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
3335
- Fixed issue where invoking an RPC, on another `NetworkBehaviour` associated with the same `NetworkObject` that is ordered before the `NetworkBehaviour` invoking the RPC, during `OnNetworkSpawn` could throw an exception if scene management is disabled. (#3782)
3436
- Fixed issue where the `Axis to Synchronize` toggles didn't work with multi object editing in `NetworkTransform`. (#3781)
3537
- Fixed issue where using the dedicated server package would override all attempts to change the port by code. (#3760)
38+
- Fixed issue with authority animator instance sending itself RPCs. (#3586)
3639

3740
### Security
3841

com.unity.netcode.gameobjects/Documentation~/components/core/networkobject.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ Similar to [`NetworkObject.ActiveSceneSynchronization`](#active-scene-synchroniz
112112

113113
`NetworkObject.ActiveSceneSynchronization` can be used with `NetworkObject.SceneMigrationSynchronization` as long as you take into consideration that if you migrate a NetworkObject into a non-active scene via `SceneManager.MoveGameObjectToScene` and later change the active scene, then the NetworkObject instance will be automatically migrated to the newly set active scene.
114114

115-
:::warning
116-
Scene migration synchronization is enabled by default. For NetworkObjects that don't require it, such as those that generate static environmental objects like trees, it's recommended to disable scene migration synchronization to avoid additional processing overheads.
117-
:::
115+
> [!NOTE]
116+
> The `NetworkObject.SceneMigrationSynchronization` field is enabled by default. If your project can have many (600-1000+) spawned objects at any given time, this setting can cause performance issues. Scene migration synchronization only provides the ability to automatically synchronize the scene a NetworkObject is migrated to while it is spawned. If your NetworkObject doesn't change scenes and you have no need for automatic scene migration synchronization (_only applies when the integration scene management is enabled_), then it's recommended to disable this property to avoid additional processing overheads.
117+
118118

119119
## Additional resources
120120

com.unity.netcode.gameobjects/Documentation~/components/helper/networkanimator.md

Lines changed: 352 additions & 60 deletions
Large diffs are not rendered by default.
70.5 KB
Loading
15.3 KB
Loading
49 KB
Loading
3.82 MB
Loading
86.9 KB
Loading
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
#if COM_UNITY_MODULES_ANIMATION
3+
using Unity.Netcode.Components;
4+
using UnityEditor;
5+
using UnityEngine;
6+
7+
namespace Unity.Netcode.Editor
8+
{
9+
[CustomPropertyDrawer(typeof(NetworkAnimator.AnimatorParametersListContainer))]
10+
internal class NetworkAnimatorParameterEntryDrawer : PropertyDrawer
11+
{
12+
// Draw the property inside the given rect
13+
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
14+
{
15+
EditorGUI.BeginProperty(position, label, property);
16+
17+
// Draw the foldout for the list
18+
SerializedProperty items = property.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntries.ParameterEntries));
19+
position.height = EditorGUIUtility.singleLineHeight;
20+
property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, label);
21+
22+
if (property.isExpanded)
23+
{
24+
// Set the indention level down
25+
EditorGUI.indentLevel++;
26+
for (int i = 0; i < items.arraySize; i++)
27+
{
28+
position.y += EditorGUIUtility.singleLineHeight + 2;
29+
SerializedProperty element = items.GetArrayElementAtIndex(i);
30+
var nameField = element.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntry.name));
31+
// Draw the foldout for the item
32+
element.isExpanded = EditorGUI.Foldout(position, element.isExpanded, nameField.stringValue);
33+
if (!element.isExpanded)
34+
{
35+
continue;
36+
}
37+
// Draw the contents of the item
38+
position.y += EditorGUIUtility.singleLineHeight + 2;
39+
// Set the indention level down
40+
EditorGUI.indentLevel++;
41+
// Calculate rects
42+
var nameHashRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
43+
position.y += EditorGUIUtility.singleLineHeight + 2;
44+
var paramRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
45+
position.y += EditorGUIUtility.singleLineHeight + 2;
46+
var syncRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
47+
48+
// Get the three properties we want to visualize in the inspector view
49+
var synchronizeField = element.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntry.Synchronize));
50+
var nameHashField = element.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntry.NameHash));
51+
var parameterTypeField = element.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntry.ParameterType));
52+
53+
// Draw the read only fields
54+
GUI.enabled = false;
55+
EditorGUI.PropertyField(nameHashRect, nameHashField);
56+
EditorGUI.PropertyField(paramRect, parameterTypeField);
57+
GUI.enabled = true;
58+
// Draw the read/write fields
59+
EditorGUI.PropertyField(syncRect, synchronizeField);
60+
// Set the indention level up
61+
EditorGUI.indentLevel--;
62+
}
63+
// Set the indention level up
64+
EditorGUI.indentLevel--;
65+
}
66+
EditorGUI.EndProperty();
67+
}
68+
69+
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
70+
{
71+
var totalHeight = EditorGUIUtility.singleLineHeight;
72+
if (!property.isExpanded)
73+
{
74+
return totalHeight;
75+
}
76+
var singleLineWithSpace = EditorGUIUtility.singleLineHeight + 2;
77+
SerializedProperty items = property.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntries.ParameterEntries));
78+
79+
totalHeight += singleLineWithSpace;
80+
for (int i = 0; i < items.arraySize; i++)
81+
{
82+
SerializedProperty element = items.GetArrayElementAtIndex(i);
83+
if (element.isExpanded)
84+
{
85+
totalHeight += (singleLineWithSpace * 4);
86+
}
87+
else
88+
{
89+
totalHeight += EditorGUIUtility.singleLineHeight;
90+
}
91+
}
92+
return totalHeight;
93+
}
94+
}
95+
}
96+
#endif

com.unity.netcode.gameobjects/Editor/NetworkAnimatorParameterEntryDrawer.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)