private void SetValue <TValue>(TextShadow instance, string fieldName, TValue value) { UnityEditorUtility.RegisterUndo("TextShadowInspector Undo", instance); Reflection.SetPrivateField(instance, fieldName, value); update = true; }
private void UpdateParams(TextShadow instance, Color color, float offsetX, float offsetY) { UnityEditorUtility.RegisterUndo("TextShadowInspector Undo", instance); Reflection.SetPrivateField(instance, "color", color); Reflection.SetPrivateField(instance, "offsetX", offsetX); Reflection.SetPrivateField(instance, "offsetY", offsetY); update = true; }
//----- property ----- //----- method ----- public override void OnInspectorGUI() { instance = target as TextShadow; var color = Reflection.GetPrivateField <TextShadow, Color>(instance, "color"); EditorGUI.BeginChangeCheck(); color = EditorGUILayout.ColorField("Color", color); if (EditorGUI.EndChangeCheck()) { SetValue(instance, "color", color); } var offsetX = Reflection.GetPrivateField <TextShadow, float>(instance, "offsetX"); EditorGUI.BeginChangeCheck(); offsetX = EditorGUILayout.DelayedFloatField("OffsetX", offsetX); if (EditorGUI.EndChangeCheck()) { SetValue(instance, "offsetX", offsetX); } var offsetY = Reflection.GetPrivateField <TextShadow, float>(instance, "offsetY"); EditorGUI.BeginChangeCheck(); offsetY = EditorGUILayout.DelayedFloatField("offsetY", offsetY); if (EditorGUI.EndChangeCheck()) { SetValue(instance, "offsetY", offsetY); } DrawMaterialSelector(instance); }