public static void EMGenerateEventsJson(MenuCommand command) { UnityEngine.Object obj = Selection.activeObject; TextAsset asset = obj as TextAsset; EventGenerationTokens tokens = JsonUtility.FromJson <EventGenerationTokens>(asset.text); PathString path = AssetDatabase.GetAssetPath(obj.GetInstanceID()); PathString folder = path.RemoveAtEnd(); for (int i = 0; i < tokens.Tokens.Length; i++) { EventGenerationToken to = tokens.Tokens[i]; EditorUtility.DisplayProgressBar( "Generating Events", $"Generating {to.Type} Event to {to.Path}", (float)i / tokens.Tokens.Length ); PathString p = UTECommonFolder.GetFolderPath(ECommonFolder.Assets) + "/" + to.Path; UTEventGeneration.GenerateEventsOfAllTypes( UTECommonFolder.GetFolderPath(ECommonFolder.Assets) + "/" + to.Path, to.Type, to.Namespace, to.MenuPath, to.EventTypeNamespace ); } EditorUtility.DisplayProgressBar( "Generating Events", $"Finalizing and Compiling", 1f ); AssetDatabase.Refresh(); EditorUtility.ClearProgressBar(); }
/// <summary> /// Returns a path to a common folder /// </summary> public static UnityPath GetPath(ECommonFolder location) { return(UTECommonFolder.GetFolderPath(location)); }