Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bde2c66
update
NoelStephensUnity Nov 13, 2024
aaf27e8
update
NoelStephensUnity Nov 14, 2024
29913e9
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Aug 6, 2025
d684643
update
NoelStephensUnity Aug 6, 2025
d338fdb
update - wip
NoelStephensUnity Aug 6, 2025
0fe48b2
update
NoelStephensUnity Aug 6, 2025
00525f7
update
NoelStephensUnity Aug 7, 2025
870a0c5
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Aug 11, 2025
d3f06be
update
NoelStephensUnity Aug 11, 2025
c59ab12
Merge branch 'fix/networkanimator-allow-disabling-or-enabling-paramet…
NoelStephensUnity Aug 11, 2025
4168bca
update
NoelStephensUnity Aug 12, 2025
27da26b
update
NoelStephensUnity Aug 12, 2025
51aaf97
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Aug 14, 2025
ab72920
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Aug 14, 2025
0a22024
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Aug 14, 2025
a36fa26
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Aug 14, 2025
7433f21
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Oct 15, 2025
af3c017
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Oct 16, 2025
86ed9f8
Merge branch 'develop-2.0.0' into fix/networkanimator-allow-disabling…
NoelStephensUnity Oct 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

#if COM_UNITY_MODULES_ANIMATION
using Unity.Netcode.Components;
using UnityEditor;
using UnityEngine;

namespace Unity.Netcode.Editor
{
[CustomPropertyDrawer(typeof(NetworkAnimator.AnimatorParametersListContainer))]
internal class NetworkAnimatorParameterEntryDrawer : PropertyDrawer
{
// Draw the property inside the given rect
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);

// Draw the foldout for the list
SerializedProperty items = property.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntries.ParameterEntries));
position.height = EditorGUIUtility.singleLineHeight;
property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, label);

if (property.isExpanded)
{
// Set the indention level down
EditorGUI.indentLevel++;
for (int i = 0; i < items.arraySize; i++)
{
position.y += EditorGUIUtility.singleLineHeight + 2;
SerializedProperty element = items.GetArrayElementAtIndex(i);
var nameField = element.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntry.name));
// Draw the foldout for the item
element.isExpanded = EditorGUI.Foldout(position, element.isExpanded, nameField.stringValue);
if (!element.isExpanded)
{
continue;
}
// Draw the contents of the item
position.y += EditorGUIUtility.singleLineHeight + 2;
// Set the indention level down
EditorGUI.indentLevel++;
// Calculate rects
var nameHashRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
position.y += EditorGUIUtility.singleLineHeight + 2;
var paramRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
position.y += EditorGUIUtility.singleLineHeight + 2;
var syncRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);

// Get the three properties we want to visualize in the inspector view
var synchronizeField = element.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntry.Synchronize));
var nameHashField = element.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntry.NameHash));
var parameterTypeField = element.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntry.ParameterType));

// Draw the read only fields
GUI.enabled = false;
EditorGUI.PropertyField(nameHashRect, nameHashField);
EditorGUI.PropertyField(paramRect, parameterTypeField);
GUI.enabled = true;
// Draw the read/write fields
EditorGUI.PropertyField(syncRect, synchronizeField);
// Set the indention level up
EditorGUI.indentLevel--;
}
// Set the indention level up
EditorGUI.indentLevel--;
}
EditorGUI.EndProperty();
}

public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
var totalHeight = EditorGUIUtility.singleLineHeight;
if (!property.isExpanded)
{
return totalHeight;
}
var singleLineWithSpace = EditorGUIUtility.singleLineHeight + 2;
SerializedProperty items = property.FindPropertyRelative(nameof(NetworkAnimator.AnimatorParameterEntries.ParameterEntries));

totalHeight += singleLineWithSpace;
for (int i = 0; i < items.arraySize; i++)
{
SerializedProperty element = items.GetArrayElementAtIndex(i);
if (element.isExpanded)
{
totalHeight += (singleLineWithSpace * 4);
}
else
{
totalHeight += EditorGUIUtility.singleLineHeight;
}
}
return totalHeight;
}
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading