@@ -13,6 +13,8 @@ public class CharacterCustomizationEditor : Editor
1313 private int shapeBlendSelectedIndex = 0 ;
1414 private bool runOnce ;
1515
16+ public Canvas canvas ;
17+
1618 public override void OnInspectorGUI ( )
1719 {
1820
@@ -64,10 +66,14 @@ public override void OnInspectorGUI()
6466
6567 shapeBlendSelectedIndex = EditorGUILayout . Popup ( "BlendShapeName" , shapeBlendSelectedIndex , blendShapeNames ) ;
6668
69+ //Canvas selector
70+ canvas = EditorGUILayout . ObjectField ( "Manual Cavas Selection:" , canvas , typeof ( Canvas ) , true ) as Canvas ;
6771
6872 if ( GUILayout . Button ( "Create Slider" ) )
6973 {
70- var canvas = GameObject . FindObjectOfType < Canvas > ( ) ;
74+ //Auto Find one if canvas is null
75+ if ( canvas == null )
76+ canvas = GameObject . FindObjectOfType < Canvas > ( ) ;
7177
7278 //If canvas doesn't exist, then make one
7379 if ( canvas == null )
@@ -96,12 +102,21 @@ public override void OnInspectorGUI()
96102 //Slider Component Properties
97103 var slider = BShapeSlider . GetComponent < Slider > ( ) ;
98104
99- Debug . Log ( blendShape . negativeIndex ) ;
105+ // Debug.Log(blendShape.negativeIndex);
100106
101- if ( blendShape . negativeIndex == - 1 )
102- {
107+ if ( blendShape . negativeIndex == - 1 )
103108 slider . minValue = 0f ;
104- }
109+
110+
111+ else if ( blendShape . positiveIndex == - 1 )
112+ slider . maxValue = 0f ;
113+
114+ else
115+ Debug . Log ( "Both Values for Blendshape are -1!?" ) ;
116+
117+ slider . value = 0f ;
118+
119+
105120
106121 Debug . Log ( "Slider \" " + BShapeSlider . blendShapeName + "\" Created!" ) ;
107122 }
0 commit comments