Skip to content

Commit d338fdb

Browse files
update - wip
Work in progress.
1 parent d684643 commit d338fdb

File tree

4 files changed

+61
-4
lines changed

4 files changed

+61
-4
lines changed

com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ public override void OnInspectorGUI()
155155
/// <summary>
156156
/// Internal use. Hides the script field for NetworkAnimator.
157157
/// </summary>
158-
[CustomEditor(typeof(NetworkAnimator), true)]
159-
public class NetworkAnimatorEditor : HiddenScriptEditor
160-
{
158+
//[CustomEditor(typeof(NetworkAnimator), true)]
159+
//public class NetworkAnimatorEditor : HiddenScriptEditor
160+
//{
161161

162-
}
162+
//}
163163
#endif
164164

165165
#if COM_UNITY_MODULES_PHYSICS
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using Unity.Netcode.Components;
2+
using UnityEditor;
3+
//using UnityEngine;
4+
5+
namespace Unity.Netcode.Editor
6+
{
7+
/// <summary>
8+
/// The <see cref="CustomEditor"/> for <see cref="NetworkAnimator"/>
9+
/// </summary>
10+
[CustomEditor(typeof(NetworkAnimator), true)]
11+
[CanEditMultipleObjects]
12+
public class NetworkAnimatorEditor : NetcodeEditorBase<NetworkAnimator>
13+
{
14+
15+
private SerializedProperty m_AuthorityMode;
16+
private SerializedProperty m_Animator;
17+
18+
public override void OnEnable()
19+
{
20+
m_AuthorityMode = serializedObject.FindProperty(nameof(NetworkAnimator.AuthorityMode));
21+
22+
m_Animator = serializedObject.FindProperty("m_Animator");
23+
}
24+
25+
private void DisplayNetworkAnimatorProperties()
26+
{
27+
var networkAnimator = target as NetworkAnimator;
28+
EditorGUILayout.PropertyField(m_AuthorityMode);
29+
EditorGUILayout.PropertyField(m_Animator);
30+
if (networkAnimator.Animator != null)
31+
{
32+
EditorGUILayout.Space();
33+
EditorGUILayout.LabelField("Animator Parameters", EditorStyles.boldLabel);
34+
{
35+
// Add parameter list here
36+
}
37+
}
38+
}
39+
40+
public override void OnInspectorGUI()
41+
{
42+
var networkAnimator = target as NetworkAnimator;
43+
void SetExpanded(bool expanded) { networkAnimator.NetworkAnimatorExpanded = expanded; }
44+
DrawFoldOutGroup<NetworkTransform>(networkAnimator.GetType(), DisplayNetworkAnimatorProperties, networkAnimator.NetworkAnimatorExpanded, SetExpanded);
45+
base.OnInspectorGUI();
46+
}
47+
}
48+
}

com.unity.netcode.gameobjects/Editor/NetworkAnimatorEditor.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.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ internal NetworkAnimatorStateChangeHandler(NetworkAnimator networkAnimator)
188188
[AddComponentMenu("Netcode/Network Animator")]
189189
public class NetworkAnimator : NetworkBehaviour, ISerializationCallbackReceiver
190190
{
191+
#if UNITY_EDITOR
192+
[HideInInspector]
193+
[SerializeField]
194+
internal bool NetworkAnimatorExpanded;
195+
#endif
196+
191197
[Serializable]
192198
internal class TransitionStateinfo
193199
{
@@ -511,6 +517,7 @@ public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReade
511517
}
512518
}
513519

520+
[Tooltip("The animator that this NetworkAnimator component will be synchronizing.")]
514521
[SerializeField] private Animator m_Animator;
515522

516523
/// <summary>

0 commit comments

Comments
 (0)