This commit is contained in:
2026-07-09 21:33:33 +02:00
commit 84a2a365f3
2364 changed files with 950134 additions and 0 deletions
@@ -0,0 +1,28 @@
using UnityEditor;
using UnityEngine;
namespace VOID.Editor.PropertyDrawers
{
[CustomPropertyDrawer(typeof(SceneReference))]
public class SceneFieldPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(rect, GUIContent.none, property);
var sceneAsset = property.FindPropertyRelative("_sceneAsset");
var scenePath = property.FindPropertyRelative("_scenePath");
// Label + Field
rect = EditorGUI.PrefixLabel(rect, GUIUtility.GetControlID(FocusType.Passive), label);
var obj = EditorGUI.ObjectField(rect, sceneAsset.objectReferenceValue, typeof(SceneAsset), false);
// Value setter
sceneAsset.objectReferenceValue = obj;
scenePath.stringValue = obj ? AssetDatabase.GetAssetPath(obj) : "";
EditorGUI.EndProperty();
}
}
}