Skip to content

Commit e6cffd6

Browse files
Remove unused NetworkObjectOwnership property drawer
Removed obsolete custom property drawer for NetworkObject.OwnershipStatus.
1 parent dcf9a26 commit e6cffd6

1 file changed

Lines changed: 0 additions & 49 deletions

File tree

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

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -221,53 +221,4 @@ private void OnDestroy()
221221
NetworkBehaviourEditor.CheckForNetworkObject(m_GameObject, true);
222222
}
223223
}
224-
225-
// Keeping this here just in case, but it appears that in Unity 6 the visual bugs with
226-
// enum flags is resolved
227-
#if BYPASS_DEFAULT_ENUM_DRAWER && MULTIPLAYER_SERVICES_SDK_INSTALLED
228-
[CustomPropertyDrawer(typeof(NetworkObject.OwnershipStatus))]
229-
[MovedFrom(true, "Unity.Netcode.Editor", "Unity.Netcode.Editor", null)]
230-
public class NetworkObjectOwnership : PropertyDrawer
231-
{
232-
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
233-
{
234-
label = EditorGUI.BeginProperty(position, label, property);
235-
// Don't allow modification while in play mode
236-
EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying);
237-
238-
// This is a temporary work around due to EditorGUI.EnumFlagsField having a bug in how it displays mask values.
239-
// For now, we will just display the flags as a toggle and handle the masking of the value ourselves.
240-
EditorGUILayout.BeginHorizontal();
241-
var names = System.Enum.GetNames(typeof(NetworkObject.OwnershipStatus)).ToList();
242-
names.RemoveAt(0);
243-
var value = property.enumValueFlag;
244-
var compareValue = 0x01;
245-
GUILayout.Label(label);
246-
foreach (var name in names)
247-
{
248-
var isSet = (value & compareValue) > 0;
249-
isSet = GUILayout.Toggle(isSet, name);
250-
if (isSet)
251-
{
252-
value |= compareValue;
253-
}
254-
else
255-
{
256-
value &= ~compareValue;
257-
}
258-
compareValue = compareValue << 1;
259-
}
260-
property.enumValueFlag = value;
261-
EditorGUILayout.EndHorizontal();
262-
263-
// The below can cause visual anomalies and/or throws an exception within the EditorGUI itself (index out of bounds of the array). and has
264-
// The visual anomaly is when you select one field it is set in the drop down but then the flags selection in the popup menu selects more items
265-
// even though if you exit the popup menu the flag setting is correct.
266-
// var ownership = (NetworkObject.OwnershipStatus)EditorGUI.EnumFlagsField(position, label, (NetworkObject.OwnershipStatus)property.enumValueFlag);
267-
// property.enumValueFlag = (int)ownership;
268-
EditorGUI.EndDisabledGroup();
269-
EditorGUI.EndProperty();
270-
}
271-
}
272-
#endif
273224
}

0 commit comments

Comments
 (0)