This repository was archived by the owner on May 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
- using System . Collections ;
1
+ using System . Reflection ;
2
+ using System . Collections ;
2
3
using System . Collections . Generic ;
3
4
using UnityEngine ;
4
5
using UnityEditor ;
5
6
6
7
[ CustomEditor ( typeof ( BaseVariable < > ) , true ) ]
7
8
public class BaseVariableEditor : Editor
8
9
{
10
+ private IBaseVariable Target { get { return ( IBaseVariable ) target ; } }
11
+
9
12
private SerializedProperty _valueProperty ;
10
13
private SerializedProperty _developerDescription ;
11
14
@@ -16,7 +19,16 @@ private void OnEnable()
16
19
}
17
20
public override void OnInspectorGUI ( )
18
21
{
19
- EditorGUILayout . PropertyField ( _valueProperty ) ;
22
+ if ( SOArchitecture_EditorUtility . HasPropertyDrawer ( Target . Type ) )
23
+ {
24
+ EditorGUILayout . PropertyField ( _valueProperty ) ;
25
+ }
26
+ else
27
+ {
28
+ EditorGUILayout . LabelField ( "Cannot display value. No PropertyDrawer for " + Target . Type ) ;
29
+ }
30
+
31
+
20
32
EditorGUILayout . PropertyField ( _developerDescription ) ;
21
33
}
22
34
}
Original file line number Diff line number Diff line change 1
1
using UnityEngine ;
2
2
3
- public abstract class BaseVariable < T > : SOArchitectureBaseObject
3
+ public interface IBaseVariable
4
+ {
5
+ System . Type Type { get ; }
6
+ }
7
+ public abstract class BaseVariable < T > : SOArchitectureBaseObject , IBaseVariable
4
8
{
5
9
public T Value { get { return _value ; } set { _value = value ; } }
10
+ public System . Type Type { get { return typeof ( T ) ; } }
6
11
7
12
[ SerializeField ]
8
13
protected T _value ;
You can’t perform that action at this time.
0 commit comments