public static void GridCoordinatesField(SerializedObject _boject) { GridCoordinates _gc = (GridCoordinates)(_boject.targetObject); Vector3 _gridXYZ = _gc._xyz; float _fWidth = EditorGUIUtility.currentViewWidth * 0.475f; float _mfWidth = _fWidth * 0.95f; using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUILayout.VerticalScope()) { Util.CustomEditorGUI.NewParagraph("[Grid Coordinates]", GUILayout.MaxWidth(_mfWidth * 0.75f)); EditorGUI.BeginChangeCheck(); EditorGUILayout.ToggleLeft( new GUIContent("Snap To Grid", "Snap to Grid Coordinates"), !_gc.bSnapFree, GUILayout.MaxWidth(_mfWidth * 0.75f)); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_gc, "Snap Free"); _gc.bSnapFree = !_gc.bSnapFree; _gc.Apply_SnapToGrid(); EditorUtility.SetDirty(_gc); } if (!_gc.bSnapFree) { EditorGUILayout.LabelField(string.Format("F{1:0}_({0:0}, {2:0})", _gridXYZ.x, _gridXYZ.y, _gridXYZ.z), GUILayout.MaxWidth(_mfWidth * 0.75f)); EditorGUILayout.Separator(); } } using (new EditorGUILayout.VerticalScope(GUILayout.Width(_fWidth * 0.4f))) { Util.CustomEditorGUI.NewParagraph("[Transform Position]", GUILayout.MaxWidth(_mfWidth * 0.9f)); EditorGUILayout.LabelField("Global" + _gc.transform.position, GUILayout.MaxWidth(_mfWidth * 0.9f)); EditorGUILayout.LabelField("Local" + _gc.transform.localPosition, GUILayout.MaxWidth(_mfWidth * 0.9f)); } } }