@@ -250,20 +250,27 @@ private static bool DrawFloatOrVector3Field(SerializedProperty sp, bool showXyz)
250250 EditorGUILayout . BeginHorizontal ( ) ;
251251 if ( showXyz )
252252 {
253+ EditorGUI . BeginChangeCheck ( ) ;
253254 EditorGUILayout . PropertyField ( sp ) ;
255+ if ( EditorGUI . EndChangeCheck ( ) )
256+ {
257+ x . floatValue = Mathf . Max ( 0.001f , x . floatValue ) ;
258+ y . floatValue = Mathf . Max ( 0.001f , y . floatValue ) ;
259+ z . floatValue = Mathf . Max ( 0.001f , z . floatValue ) ;
260+ }
254261 }
255262 else
256263 {
257264 EditorGUI . BeginChangeCheck ( ) ;
258265 EditorGUILayout . PropertyField ( x , s_ContentScale ) ;
259266 if ( EditorGUI . EndChangeCheck ( ) )
260- z . floatValue = y . floatValue = x . floatValue ;
267+ {
268+ x . floatValue = Mathf . Max ( 0.001f , x . floatValue ) ;
269+ y . floatValue = Mathf . Max ( 0.001f , x . floatValue ) ;
270+ z . floatValue = Mathf . Max ( 0.001f , x . floatValue ) ;
271+ }
261272 }
262273
263- if ( x . floatValue < 0.001f ) x . floatValue = 0.001f ;
264- if ( y . floatValue < 0.001f ) y . floatValue = 0.001f ;
265- if ( z . floatValue < 0.001f ) z . floatValue = 0.001f ;
266-
267274 EditorGUI . BeginChangeCheck ( ) ;
268275 showXyz = GUILayout . Toggle ( showXyz , s_Content3D , EditorStyles . miniButton , GUILayout . Width ( 30 ) ) ;
269276 if ( EditorGUI . EndChangeCheck ( ) && ! showXyz )
0 commit comments