/*WIP * [MenuItem(MenuRoot + "Tools/Scan Scenes", false, 33)] * public static void ScanScenesInProject() * { * FindAllScenes(); * } */ private static void DoPreprocessPrefabFSMs() { Debug.Log("Preprocessing Prefab FSMs..."); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { //Debug.Log(FsmEditorUtility.GetFullFsmLabel(playMakerFSM)); if (!FsmPrefabs.IsPrefab(playMakerFSM.Fsm)) { continue; } #if UNITY_2018_3_OR_NEWER var assetPath = AssetDatabase.GetAssetPath(playMakerFSM); var go = PrefabUtility.LoadPrefabContents(assetPath); var prefabFSMs = go.GetComponents <PlayMakerFSM>(); foreach (var prefabFSM in prefabFSMs) { prefabFSM.Preprocess(); EditorUtility.SetDirty(prefabFSM); } PrefabUtility.SaveAsPrefabAsset(go, assetPath); PrefabUtility.UnloadPrefabContents(go); #else playMakerFSM.Preprocess(); EditorUtility.SetDirty(playMakerFSM); #endif } }
public static void OnPostprocessScene() { /* TODO: Figure out if we need to do this! * // OnPostprocessScene is called when loading a scene in the editor * // Might not want to post process in that case...? * if (EditorApplication.isPlayingOrWillChangePlaymode) * { * return; * }*/ //Debug.Log("OnPostprocessScene"); if (Application.isPlaying) // playing in editor, not really making a build { return; } PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.InitApplicationFlags(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { //Debug.Log(FsmEditorUtility.GetFullFsmLabel(playMakerFSM)); #if UNITY_2018_3_OR_NEWER // TODO: we need a new build tool to process prefabs if (FsmPrefabs.IsPrefab(playMakerFSM.Fsm)) { var assetPath = AssetDatabase.GetAssetPath(playMakerFSM); var go = PrefabUtility.LoadPrefabContents(assetPath); var prefabFSMs = go.GetComponents <PlayMakerFSM>(); foreach (var prefabFSM in prefabFSMs) { prefabFSM.Preprocess(); } PrefabUtility.SaveAsPrefabAsset(go, assetPath); PrefabUtility.UnloadPrefabContents(go); continue; } #endif playMakerFSM.Preprocess(); } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }
/*WIP * [MenuItem(MenuRoot + "Tools/Scan Scenes", false, 33)] * public static void ScanScenesInProject() * { * FindAllScenes(); * } */ private static void DoPreprocessPrefabFSMs() { Debug.Log("Preprocessing Prefab FSMs..."); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { //Debug.Log(FsmEditorUtility.GetFullFsmLabel(playMakerFSM)); if (!FsmPrefabs.IsPrefab(playMakerFSM.Fsm)) { continue; } playMakerFSM.Preprocess(); EditorUtility.SetDirty(playMakerFSM); } }
public static void OnPostprocessScene() { /* TODO: Figure out if we need to do this! * // OnPostprocessScene is called when loading a scene in the editor * // Might not want to post process in that case...? * if (EditorApplication.isPlayingOrWillChangePlaymode) * { * return; * }*/ //Debug.Log("OnPostprocessScene: " + SceneManager.GetActiveScene().name); if (Application.isPlaying) // playing in editor, not really making a build { return; } PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.InitApplicationFlags(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { if (playMakerFSM == null) { continue; // not sure when this happens, but need to catch it... } #if UNITY_5_6_OR_NEWER if (FsmPrefabs.IsPrefab(playMakerFSM)) { // already processed by PlayMakerPreProcessBuild continue; } #endif playMakerFSM.Preprocess(); } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }
/// <summary> /// Get loaded prefab files that have PlayMakerFSMs /// </summary> public static void GetLoadedPrefabFSMs(List <string> prefabs) { var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); for (var i = 0; i < fsmList.Length; i++) { var playMakerFSM = fsmList[i]; if (playMakerFSM == null || !FsmPrefabs.IsPrefab(playMakerFSM.Fsm)) { continue; } var assetPath = AssetDatabase.GetAssetPath(playMakerFSM); if (prefabs.Contains(assetPath)) { continue; } prefabs.Add(assetPath); } }
public static void OnPostProcessScene() { // No need to post process if playing in editor, // sine we're not really making a build if (Application.isPlaying) { return; } DebugLog("OnPostProcessScene", LogColor.Yellow); PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.InitApplicationFlags(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { // not sure when this happens, but need to catch it... if (playMakerFSM == null) { continue; } // PlayMakerPreProcessBuild has already processed prefabs if (FsmPrefabs.IsPrefab(playMakerFSM)) { continue; } playMakerFSM.Preprocess(); StripEditorData(playMakerFSM); } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }
public static void OnPostprocessScene() { /* TODO: Figure out if we need to do this! * // OnPostprocessScene is called when loading a scene in the editor * // Might not want to post process in that case...? * if (EditorApplication.isPlayingOrWillChangePlaymode) * { * return; * }*/ //Debug.Log("OnPostprocessScene"); if (Application.isPlaying) // playing in editor, not really making a build { return; } PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.InitApplicationFlags(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { //Debug.Log(FsmEditorUtility.GetFullFsmLabel(playMakerFSM)); // TODO: we need a new build tool to process prefabs if (FsmPrefabs.IsPrefab(playMakerFSM.Fsm)) { continue; } playMakerFSM.Preprocess(); } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }