Пример #1
0
        public void DrawSlider(Rect position, SerializedProperty property, FieldOption option)
        {
            if (property.propertyType != SerializedPropertyType.Integer)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{nameof(SceneSliderAttribute)} can be used only on int fields");
                return;
            }

            var max = SceneManager.sceneCountInBuildSettings - 1;

            position.height = MightyGUIUtilities.FIELD_HEIGHT;

            property.intValue = option.Contains(FieldOption.HideLabel)
                ? EditorGUI.IntSlider(position, property.intValue, 0, max)
                : EditorGUI.IntSlider(position, property.displayName, property.intValue, 0, max);

            position = MightyGUIUtilities.JumpLine(position, false);

            EditorGUI.LabelField(position, Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(property.intValue)),
                                 EditorStyles.boldLabel);
        }