@@ -43,6 +43,7 @@ public class NetworkTransformEditor : NetcodeEditorBase<NetworkTransform>
4343 private SerializedProperty m_AuthorityMode ;
4444
4545 private static int s_ToggleOffset = 45 ;
46+ private static int s_IndentOffset = 15 ;
4647 private static float s_MaxRowWidth = EditorGUIUtility . labelWidth + EditorGUIUtility . fieldWidth + 5 ;
4748 private static GUIContent s_PositionLabel = EditorGUIUtility . TrTextContent ( "Position" ) ;
4849 private static GUIContent s_RotationLabel = EditorGUIUtility . TrTextContent ( "Rotation" ) ;
@@ -191,38 +192,35 @@ private void DisplayNetworkTransformProperties()
191192 {
192193 if ( networkTransform . SynchronizePosition )
193194 {
194- EditorGUILayout . PropertyField ( m_PositionInterpolationTypeProperty ) ;
195+ DrawIndentedPropertyField ( 1 , m_PositionInterpolationTypeProperty ) ;
195196 // Only display when using Lerp.
196197 if ( networkTransform . PositionInterpolationType == NetworkTransform . InterpolationTypes . Lerp )
197198 {
198- EditorGUILayout . PropertyField ( m_SlerpPosition ) ;
199- EditorGUILayout . PropertyField ( m_PositionMaximumInterpolationTimeProperty ) ;
199+ DrawIndentedPropertyField ( 2 , m_SlerpPosition ) ;
200+ DrawIndentedPropertyField ( 2 , m_PositionMaximumInterpolationTimeProperty ) ;
200201 }
201202 }
202203 if ( networkTransform . SynchronizeRotation )
203204 {
204- EditorGUILayout . PropertyField ( m_RotationInterpolationTypeProperty ) ;
205-
205+ DrawIndentedPropertyField ( 1 , m_RotationInterpolationTypeProperty ) ;
206206 // Only display when using Lerp.
207207 if ( networkTransform . RotationInterpolationType == NetworkTransform . InterpolationTypes . Lerp )
208208 {
209- EditorGUILayout . PropertyField ( m_RotationMaximumInterpolationTimeProperty ) ;
209+ DrawIndentedPropertyField ( 2 , m_RotationMaximumInterpolationTimeProperty ) ;
210210 }
211211 }
212212 if ( networkTransform . SynchronizeScale )
213213 {
214- EditorGUILayout . PropertyField ( m_ScaleInterpolationTypeProperty ) ;
214+ DrawIndentedPropertyField ( 1 , m_ScaleInterpolationTypeProperty ) ;
215215 // Only display when using Lerp.
216216 if ( networkTransform . ScaleInterpolationType == NetworkTransform . InterpolationTypes . Lerp )
217217 {
218- EditorGUILayout . PropertyField ( m_ScaleMaximumInterpolationTimeProperty ) ;
218+ DrawIndentedPropertyField ( 2 , m_ScaleMaximumInterpolationTimeProperty ) ;
219219 }
220220 }
221221 }
222-
223222 }
224223
225-
226224 EditorGUILayout . PropertyField ( m_UseQuaternionSynchronization ) ;
227225 if ( m_UseQuaternionSynchronization . boolValue )
228226 {
@@ -252,7 +250,16 @@ private void DisplayNetworkTransformProperties()
252250#endif // COM_UNITY_MODULES_PHYSICS2D
253251 }
254252
255-
253+ private void DrawIndentedPropertyField ( int indentLevel , SerializedProperty property )
254+ {
255+ var originalWidth = EditorGUIUtility . labelWidth ;
256+ EditorGUIUtility . labelWidth = originalWidth - ( indentLevel * s_IndentOffset ) - 2 ;
257+ EditorGUILayout . BeginHorizontal ( ) ;
258+ EditorGUILayout . Space ( indentLevel * s_IndentOffset , false ) ;
259+ EditorGUILayout . PropertyField ( property , GUILayout . ExpandWidth ( true ) ) ;
260+ EditorGUILayout . EndHorizontal ( ) ;
261+ EditorGUIUtility . labelWidth = originalWidth ;
262+ }
256263
257264 /// <inheritdoc/>
258265 public override void OnInspectorGUI ( )
0 commit comments