public void LogAction(FsmLogType logType, string text, bool sendToUnityLog = false) { if (FsmExecutionStack.ExecutingAction == null) { switch (logType) { case FsmLogType.Info: Debug.Log(text); break; case FsmLogType.Warning: Debug.LogWarning(text); break; case FsmLogType.Error: Debug.LogError(text); break; default: Debug.Log(text); break; } } else { FsmLogEntry fsmLogEntry = NewFsmLogEntry(logType); fsmLogEntry.State = FsmExecutionStack.ExecutingState; fsmLogEntry.Action = FsmExecutionStack.ExecutingAction; fsmLogEntry.Text = FsmUtility.StripNamespace(FsmExecutionStack.ExecutingAction.ToString()) + " : " + text; AddEntry(fsmLogEntry, sendToUnityLog); } }
/// <summary> /// Helper that can be called by reflection from runtime class without referencing UnityEditor /// E.g. When Fsm is loaded it can need fixing and then needs to be marked dirty /// </summary> public static void SetDirty(Fsm fsm) { #if UNITY_EDITOR // Unity 5.3.2 disallows scene dirty calls when playing if (PlayMakerGlobals.IsPlaying) { return; } if (fsm == null || fsm.OwnerObject == null) { return; } if (doLog) { Debug.Log("FSM Updated: " + FsmUtility.GetFullFsmLabel(fsm) + "\nPlease re-save the scene/project.", fsm.OwnerObject); } fsm.Preprocessed = false; // force pre-process to run again if (fsm.UsedInTemplate != null) { EditorUtility.SetDirty(fsm.UsedInTemplate); } else if (fsm.Owner != null) { EditorUtility.SetDirty(fsm.Owner); #if !UNITY_PRE_5_3 if (fsm.Owner.gameObject != null) { UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(fsm.Owner.gameObject.scene); } #elif !UNITY_PRE_5_0 // Not sure if we need to do this...? UnityEditor.EditorApplication.MarkSceneDirty(); #endif } #endif }
public static void LogError(PlayMakerFSM fsm, FsmState state, FsmStateAction action, int actionIndex, string logLine) { Log(fsm, state, action, actionIndex, logLine, "", isError: true); Debug.LogError(FsmUtility.GetPath(state, action) + logLine, fsm); ErrorCount++; }
public void DebugLog() { Debug.Log("Sent By: " + FsmUtility.GetPath(SentByState) + " : " + ((Action != null) ? Action.Name : "None (Action)")); }