39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace MegaKoop.UI.Editor
|
|
{
|
|
public static class CreatePanelSettings
|
|
{
|
|
[MenuItem("Assets/Create/UI Toolkit/Panel Settings Asset (Custom)", false, 10)]
|
|
public static void CreatePanelSettingsAsset()
|
|
{
|
|
// Vytvoření Panel Settings instance
|
|
var panelSettings = ScriptableObject.CreateInstance<PanelSettings>();
|
|
|
|
// Základní nastavení
|
|
panelSettings.scaleMode = PanelScaleMode.ConstantPixelSize;
|
|
panelSettings.scale = 1.0f;
|
|
panelSettings.fallbackDpi = 96;
|
|
panelSettings.referenceDpi = 96;
|
|
panelSettings.referenceResolution = new Vector2Int(1920, 1080);
|
|
panelSettings.screenMatchMode = PanelScreenMatchMode.MatchWidthOrHeight;
|
|
panelSettings.match = 0.5f;
|
|
panelSettings.sortingOrder = 0;
|
|
|
|
// Uložení assetu
|
|
string path = "Assets/UI/MainMenuPanelSettings.asset";
|
|
AssetDatabase.CreateAsset(panelSettings, path);
|
|
AssetDatabase.SaveAssets();
|
|
AssetDatabase.Refresh();
|
|
|
|
// Výběr vytvořeného assetu
|
|
Selection.activeObject = panelSettings;
|
|
EditorGUIUtility.PingObject(panelSettings);
|
|
|
|
Debug.Log($"Panel Settings asset vytvořen: {path}");
|
|
}
|
|
}
|
|
}
|