Skip to content

Commit bf00e71

Browse files
committed
FINALLLYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
1 parent 2a4a748 commit bf00e71

3 files changed

Lines changed: 42 additions & 22 deletions

File tree

Editor/DrawerMenu.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public override void onGUI()
6666
}
6767
public override void Update()
6868
{
69-
//Debug.Log(serializedProperty.arraySize);
69+
serializedProperty.enumValueIndex = 14;
70+
Debug.Log(serializedProperty.serializedObject.ApplyModifiedProperties());
7071
}
7172
void onValueGUI(T val){
7273
setValue(val);

Editor/KeyCodeDrawer.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
[CanEditMultipleObjects]
1010
public class KeyCodeDrawer : PropertyDrawer
1111
{
12-
private KeyCode _selectedKey = KeyCode.None;
13-
private bool _bChangeKey = false;
1412
SerializedProperty p;
1513

1614
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
@@ -39,12 +37,6 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
3937
// Get the KeyCode enum by converting the name to KeyCode.
4038
var propKey = (KeyCode)Enum.Parse(typeof(KeyCode), propEnumName);
4139

42-
// Only change the keys if they differ from the input selection and make sure
43-
// not to override it with the default value.
44-
if (_selectedKey != propKey && _selectedKey != KeyCode.None) {
45-
_bChangeKey = true;
46-
}
47-
4840
string keyName = Enum.GetName(typeof(KeyCode), propKey);
4941

5042
// Offset the button from the label.
@@ -58,7 +50,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
5850

5951
// Apply changes if necessary, this way, the default _selectedKey value
6052
// does not incorrectly override the property enum value.
61-
if (_bChangeKey) {
53+
/*if (_bChangeKey) {
6254
6355
// Since we cannot set the enum value of the serialized property directly,
6456
// we need to get the enumValueIndex associated to the KeyCode name.
@@ -84,7 +76,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
8476
8577
_bChangeKey = false;
8678
return;
87-
}
79+
}*/
8880

8981
EditorGUI.EndProperty();
9082
}
@@ -105,7 +97,7 @@ private void selectKey()
10597
int i = 0;
10698
foreach (KeyCode k in keyCodes) {
10799
drawer[i] = new DrawerOption<KeyCode>(()=>keys, k.ToString(), key => {
108-
_selectedKey = key;
100+
//_selectedKey = key;
109101
p.enumValueIndex = 4;}, p);
110102
keys[i++] = k;
111103
}

Samples/EntityExamples.unity

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ GameObject:
417417
- component: {fileID: 1742347590}
418418
- component: {fileID: 1742347589}
419419
- component: {fileID: 1742347588}
420+
- component: {fileID: 1742347592}
420421
m_Layer: 5
421422
m_Name: Canvas
422423
m_TagString: Untagged
@@ -505,6 +506,29 @@ RectTransform:
505506
m_AnchoredPosition: {x: 0, y: 0}
506507
m_SizeDelta: {x: 0, y: 0}
507508
m_Pivot: {x: 0, y: 0}
509+
--- !u!114 &1742347592
510+
MonoBehaviour:
511+
m_ObjectHideFlags: 0
512+
m_CorrespondingSourceObject: {fileID: 0}
513+
m_PrefabInstance: {fileID: 0}
514+
m_PrefabAsset: {fileID: 0}
515+
m_GameObject: {fileID: 1742347587}
516+
m_Enabled: 1
517+
m_EditorHideFlags: 0
518+
m_Script: {fileID: 11500000, guid: 9ce27d69e8fc57943908a4d8334575f7, type: 3}
519+
m_Name:
520+
m_EditorClassIdentifier:
521+
inputData:
522+
profile:
523+
- inputName: Interaction
524+
inputKey: 101
525+
joystickKey: 0
526+
- inputName: Pause
527+
inputKey: 39
528+
joystickKey: 4
529+
- inputName: Info
530+
inputKey: 13
531+
joystickKey: 5
508532
--- !u!1 &1878767017
509533
GameObject:
510534
m_ObjectHideFlags: 0
@@ -638,31 +662,34 @@ MonoBehaviour:
638662
inputData:
639663
profile:
640664
- inputName: Interaction
641-
inputKey: 34
665+
inputKey: 39
642666
joystickKey: 0
643667
- inputName: Pause
644-
inputKey: 34
668+
inputKey: 27
645669
joystickKey: 4
646670
- inputName: Info
647-
inputKey: 34
671+
inputKey: 27
648672
joystickKey: 5
649673
- inputName: Example
650-
inputKey: 34
674+
inputKey: 39
651675
joystickKey: 6
652676
- inputName: Example1
653-
inputKey: 34
677+
inputKey: 27
654678
joystickKey: 10
655-
- inputName: Example2
656-
inputKey: 34
679+
- inputName: dada
680+
inputKey: 39
657681
joystickKey: 11
658682
- inputName: Example3
659-
inputKey: 34
683+
inputKey: 27
660684
joystickKey: 7
661685
- inputName: Example4
662-
inputKey: 34
686+
inputKey: 27
663687
joystickKey: 8
664688
- inputName: Example5
665-
inputKey: 34
689+
inputKey: 27
690+
joystickKey: 9
691+
- inputName: Example5
692+
inputKey: 13
666693
joystickKey: 9
667694
--- !u!114 &2027691194
668695
MonoBehaviour:

0 commit comments

Comments
 (0)