private static void CheckActionForErrors(SkillState state, SkillStateAction action) { if (action == null) { FsmErrorChecker.AddError(new FsmError(state, null, Strings.get_FsmErrorChecker_MissingActionError())); return; } action.Init(state); FsmErrorChecker.fsmEventTargetContext = null; string actionLabel = Labels.GetActionLabel(action); if (FsmEditorSettings.CheckForMissingActions && action is MissingAction) { FsmErrorChecker.AddError(new FsmError(state, action, Strings.get_FsmErrorChecker_StateHasMissingActionError())); return; } if (FsmEditorSettings.CheckForObsoleteActions) { string obsoleteMessage = CustomAttributeHelpers.GetObsoleteMessage(action.GetType()); if (!string.IsNullOrEmpty(obsoleteMessage)) { FsmErrorChecker.AddError(new FsmError(state, action, obsoleteMessage)); } } Type type = action.GetType(); FieldInfo[] fields = ActionData.GetFields(type); FieldInfo[] array = fields; for (int i = 0; i < array.Length; i++) { FieldInfo fieldInfo = array[i]; Type fieldType = fieldInfo.get_FieldType(); object value = fieldInfo.GetValue(action); if (fieldType == typeof(SkillEventTarget)) { SkillEventTarget fsmEventTarget = (SkillEventTarget)value; if (actionLabel == "Set Event Target") { FsmErrorChecker.fsmEventTargetContextGlobal = fsmEventTarget; } else { FsmErrorChecker.fsmEventTargetContext = fsmEventTarget; } } FsmErrorChecker.CheckActionParameter(state, action, fieldInfo); } string text = ""; try { text = action.ErrorCheck(); } catch (Exception ex) { Debug.Log(string.Concat(new object[] { "Bad ErrorCheck: ", type, "\n", ex })); } if (!string.IsNullOrEmpty(text)) { FsmErrorChecker.AddError(new FsmError(state, action, text)); } }