-
Notifications
You must be signed in to change notification settings - Fork 15
Open Question: What is the general solution for handling optional dependencies in project? #2
Copy link
Copy link
Open
Description
After having a lengthy discussion with Lukasz P here at Unity I figured I'd write some of my notes down to capture ideas that could improve CCU or invalidate its need.
Here are some possible paths to explore:
- Make use of the CompilationPipeline (requires 2017.3 or later).
- Use wrapper classes around optional dependencies that bind methods, properties, fields, etc. using Reflection.
- Have a gist/snippet of code that dependencies could have to register themselves with AutoLOD (and possibly use Cecil to inject interface usage back into the assembly; otherwise automagical detection of method signatures would likely be required).
- Have optional dependency C# code with a separate extension that won't compile automatically under Unity and then use the CSharpCodeProvider or Editor.CompileCSharp (similar to what EditorVR does for a test) to create that assembly/code and either load in dynamically (and have in a temp folder) or move the assembly into the project.
- Similar to the above, name the C# file to have a separate extension and then name back when a dependency is detected; This is not likely a good solution as it would not work if the package was immutable.
- When PackMan releases for dev use, potentially move off dependent code into another package that can depend on the optional dependency. Then, a user could select which packages they wanted to include alongside the main package (hopefully, there would be a good way to show these associated packages in the UI).
- This would require some changes to Unity, but a toggle in metadata for a C# file could exist for whether it gets compiled or not, similar to VS.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.