Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions 2 com.unity.netcode.gameobjects/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Additional documentation and release notes are available at [Multiplayer Documen

### Fixed

- Fixed issue where the `Axis to Synchronize` toggles didn't work with multi object editing in `NetworkTransform`. (#3781)


### Security

Expand Down
40 changes: 31 additions & 9 deletions 40 com.unity.netcode.gameobjects/Editor/NetworkTransformEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ private void DisplayNetworkTransformProperties()
rect = EditorGUI.PrefixLabel(rect, ctid, s_PositionLabel);
rect.width = s_ToggleOffset;

m_SyncPositionXProperty.boolValue = EditorGUI.ToggleLeft(rect, "X", m_SyncPositionXProperty.boolValue);
DrawToggleProperty(rect, "X", m_SyncPositionXProperty);
rect.x += s_ToggleOffset;
m_SyncPositionYProperty.boolValue = EditorGUI.ToggleLeft(rect, "Y", m_SyncPositionYProperty.boolValue);
DrawToggleProperty(rect, "Y", m_SyncPositionYProperty);
rect.x += s_ToggleOffset;
m_SyncPositionZProperty.boolValue = EditorGUI.ToggleLeft(rect, "Z", m_SyncPositionZProperty.boolValue);
DrawToggleProperty(rect, "Z", m_SyncPositionZProperty);

GUILayout.EndHorizontal();
}
Expand All @@ -126,11 +126,11 @@ private void DisplayNetworkTransformProperties()
rect = EditorGUI.PrefixLabel(rect, ctid, s_RotationLabel);
rect.width = s_ToggleOffset;

m_SyncRotationXProperty.boolValue = EditorGUI.ToggleLeft(rect, "X", m_SyncRotationXProperty.boolValue);
DrawToggleProperty(rect, "X", m_SyncRotationXProperty);
rect.x += s_ToggleOffset;
m_SyncRotationYProperty.boolValue = EditorGUI.ToggleLeft(rect, "Y", m_SyncRotationYProperty.boolValue);
DrawToggleProperty(rect, "Y", m_SyncRotationYProperty);
rect.x += s_ToggleOffset;
m_SyncRotationZProperty.boolValue = EditorGUI.ToggleLeft(rect, "Z", m_SyncRotationZProperty.boolValue);
DrawToggleProperty(rect, "Z", m_SyncRotationZProperty);

GUILayout.EndHorizontal();
}
Expand All @@ -150,11 +150,11 @@ private void DisplayNetworkTransformProperties()
rect = EditorGUI.PrefixLabel(rect, ctid, s_ScaleLabel);
rect.width = s_ToggleOffset;

m_SyncScaleXProperty.boolValue = EditorGUI.ToggleLeft(rect, "X", m_SyncScaleXProperty.boolValue);
DrawToggleProperty(rect, "X", m_SyncScaleXProperty);
rect.x += s_ToggleOffset;
m_SyncScaleYProperty.boolValue = EditorGUI.ToggleLeft(rect, "Y", m_SyncScaleYProperty.boolValue);
DrawToggleProperty(rect, "Y", m_SyncScaleYProperty);
rect.x += s_ToggleOffset;
m_SyncScaleZProperty.boolValue = EditorGUI.ToggleLeft(rect, "Z", m_SyncScaleZProperty.boolValue);
DrawToggleProperty(rect, "Z", m_SyncScaleZProperty);

GUILayout.EndHorizontal();
}
Expand Down Expand Up @@ -281,6 +281,28 @@ private void DisplayNetworkTransformProperties()
#endif // COM_UNITY_MODULES_PHYSICS2D
}

/// <summary>
/// Draw a ToggleLeft property field so it will support multi selection editing if applicable.
/// </summary>
private void DrawToggleProperty(Rect rect, string label, SerializedProperty property)
{
if (property.hasMultipleDifferentValues)
{
EditorGUI.showMixedValue = true;
EditorGUI.BeginChangeCheck();
bool enabled = EditorGUI.ToggleLeft(rect, label, property.boolValue);
if (EditorGUI.EndChangeCheck())
{
property.boolValue = enabled;
}
EditorGUI.showMixedValue = false;
}
else
{
property.boolValue = EditorGUI.ToggleLeft(rect, label, property.boolValue);
}
}

/// <inheritdoc/>
public override void OnInspectorGUI()
{
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.