Skip to content

Commit

Permalink
Global Dependency Scene Injection
Browse files Browse the repository at this point in the history
- Fixed issue where only root objects of the scene where injected.
- Removed the option to export examples separately because they were moved in the Toolkit folder itself.
  • Loading branch information
juniordiscart committed May 11, 2021
1 parent 41dca44 commit b7fec88
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
40 changes: 20 additions & 20 deletions Assets/Editor/Export/ExportPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ private static void ExportToolkit()
AssetDatabase.ExportPackage("Assets/Impossible Odds", fullPath, ExportPackageOptions.Recurse);
}

[MenuItem("Assets/Impossible Odds/Export Toolkit Examples")]
private static void ExportExamples()
{
string path = EditorPrefs.GetString(ExportPackageDirectoryKey, Application.dataPath);
string name = EditorPrefs.GetString(ExportPackageExamplesNameKey, "Impossible Odds Toolkit Examples");
string fullPath = EditorUtility.SaveFilePanel("Export Impossible Odds Examples", path, name, PackageExtension);

if (string.IsNullOrEmpty(fullPath))
{
return;
}

FileInfo fileInfo = new FileInfo(fullPath);
path = fileInfo.DirectoryName;
name = Path.GetFileNameWithoutExtension(fileInfo.Name);
EditorPrefs.SetString(ExportPackageDirectoryKey, path);
EditorPrefs.SetString(ExportPackageExamplesNameKey, name);

AssetDatabase.ExportPackage("Assets/Examples/Impossible Odds", fullPath, ExportPackageOptions.Recurse);
}
// [MenuItem("Assets/Impossible Odds/Export Toolkit Examples")]
// private static void ExportExamples()
// {
// string path = EditorPrefs.GetString(ExportPackageDirectoryKey, Application.dataPath);
// string name = EditorPrefs.GetString(ExportPackageExamplesNameKey, "Impossible Odds Toolkit Examples");
// string fullPath = EditorUtility.SaveFilePanel("Export Impossible Odds Examples", path, name, PackageExtension);

// if (string.IsNullOrEmpty(fullPath))
// {
// return;
// }

// FileInfo fileInfo = new FileInfo(fullPath);
// path = fileInfo.DirectoryName;
// name = Path.GetFileNameWithoutExtension(fileInfo.Name);
// EditorPrefs.SetString(ExportPackageDirectoryKey, path);
// EditorPrefs.SetString(ExportPackageExamplesNameKey, name);

// AssetDatabase.ExportPackage("Assets/Examples/Impossible Odds", fullPath, ExportPackageOptions.Recurse);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private IEnumerable<MethodInfo> FindStaticMethods(Type attributeType)
private void OnSceneLoaded(Scene scene, LoadSceneMode sceneLoadMode)
{
Log.Info("Injecting scene '{0}' with the global dependency context.", scene.name);
scene.GetRootGameObjects().Inject(DependencyContainer);
scene.GetRootGameObjects().Inject(DependencyContainer, true);
}
}
}
8 changes: 8 additions & 0 deletions Assets/Impossible Odds/Toolkit/Scripts/Extensions.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b7fec88

Please # to comment.