Files
AR-Menu/Library/PackageCache/com.needle.engine-exporter@8c046140a1d9/Shaders/Runtime/SkyboxExportSettings.cs
2025-11-30 08:35:03 +02:00

37 lines
968 B
C#

using UnityEditor;
using UnityEngine;
namespace Needle.Engine.Shaders
{
public class SkyboxExportSettings : MonoBehaviour, ISkyboxExportSettingsProvider
{
[field: SerializeField] public int SkyboxResolution { get; set; } = 256;
[field: SerializeField, HideInInspector]
public bool HDR { get; set; } = true;
private void OnValidate()
{
SkyboxResolution = Mathf.NextPowerOfTwo(SkyboxResolution);
}
#if UNITY_EDITOR
[CustomEditor(typeof(SkyboxExportSettings))]
private class SkyboxEditor : Editor
{
private SerializedProperty _skyboxResolution;
public override void OnInspectorGUI()
{
using (var change = new EditorGUI.ChangeCheckScope())
{
if (_skyboxResolution == null)
_skyboxResolution = serializedObject.FindProperty("<SkyboxResolution>k__BackingField");
EditorGUILayout.DelayedIntField(_skyboxResolution);
if (change.changed) serializedObject.ApplyModifiedProperties();
}
}
}
#endif
}
}