Skip to content
Snippets Groups Projects
Commit 2f361f4c authored by Samuel Truman's avatar Samuel Truman
Browse files

Created dedicated event function for Spoke Scene importer

parent 730eb2e5
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,13 @@ public abstract class PackageConfigurator {
/// </summary>
public virtual void Init(){}
/// <summary>
/// Called once for every scene in the Unity project. At the time of
/// execution, the scene is being created. Use this method to create Unity scenes from glTF files.
/// All changes to the scene are saved after execution.
/// </summary>
public virtual void SetupScene(){}
/// <summary>
/// Called once for every scene in the Unity project. At the time of
/// execution, the scene is loaded. All changes to the scene are saved
......
......@@ -7,25 +7,30 @@ namespace de.jmu.ge.viavr.UnityBridge.Core {
public static class UnityBridge {
public static void ExecuteAll() {
Init();
SetupScene();
OnConfigureScene();
OnPostConfiguration();
}
public static void Init() => CallMethods(nameof(PackageConfigurator.Init));
public static void OnConfigureScene() {
public static void SetupScene() => CallMethodsPerScene(nameof(PackageConfigurator.SetupScene));
public static void OnConfigureScene() => CallMethodsPerScene(nameof(PackageConfigurator.OnConfigureScene));
public static void OnPostConfiguration() => CallMethods(nameof(PackageConfigurator.OnPostConfiguration));
private static void CallMethodsPerScene(string methodName) {
string[] searchInFolders = {"Assets"};
var guids = AssetDatabase.FindAssets("t:Scene", searchInFolders);
foreach(var guid in guids) {
var assetPath = AssetDatabase.GUIDToAssetPath(guid);
EditorSceneManager.OpenScene(assetPath);
CallMethods(nameof(PackageConfigurator.OnConfigureScene));
CallMethods(methodName);
EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene());
}
}
public static void OnPostConfiguration() => CallMethods(nameof(PackageConfigurator.OnPostConfiguration));
private static void CallMethods(string methodName) {
AppDomain.CurrentDomain
.GetAssemblies()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment