Convert to Unity Package Manager (UPM) package#165
Conversation
|
Thanks for the contribution. At this stage, I am basically going to copy your .asmdef/package definitions as a stage 1 to permit installing DR2 from the UPM. I need to discuss with @JamJar00 if it makes sense to port tests to Unity, and to what degree. DR2 is not really Unity specific. |
|
After porting this to a subset of the changes as described in my previous message, I'm unsure of Empirically, I have a basically empty project, where I can't find any DarkRift types from my new script unless I turn autoReferenced to true. But maybe I messed something up in how I did this. I will link in my other PR. I guess it would be weird if |
Yes. When there's no auto-referencing, it forces users to declare explicitly they want to use the assembly, forcing users to create and organize their their client/server assemblies through asmdefs, as shown in the screenshots above. Which albeit requires setup on the users side (creating one folder per assembly + an asmdef in there), helps maintain common+client+server assemblies in the same project and define how they reference each other and when/if they should be included in the compilation. If you don't want users having to define their asmdefs, here's other ideas that come to mind:
However, on none of these scenarios it's easy to keep your network-related codebase in Unity, since everything will live in the same assembly (Assembly-CSharp). (On most scenarios) users would still have to maintain server (and common?) outside Unity. |
This draft illustrates how the repository could become a package compatible with Unity Package Manager.
This branch can be directly fed into Unity (more details on the Unity docs):
https://github.com/frarees/DarkRift.git#upmAdditionally, UPM packages can be:
.tgzfiles added as releases in GitHub) using npm pack.The current repository folder structure is not the only way to set up UPM package support. This structure favours ease of use and maintainability when UPM is the main distribution mechanism and Unity the main target.
This proposal makes DarkRift accessible for Unity developers across desktop platforms to contribute and navigate through DarkRift's code:
Other benefits:
.unitypackagefiles. Unity handles package installation, removal and upgrading through the package manager window and APIs.Assets/, but inPackages/in read-only mode (unless you install the package for development, in which case you can modify it. Which is the intended setup for contributors).Note how client, server and common assemblies are defined in the same Unity project. The server DLL is discovered by the
XmlUnityServerwithout additional actions (compiled assemblies are located underLibrary/ScriptAssemblies).Downsides:
TODOs:
Feel free to list additional items I might have missed.
Note that Unity is planning to support first-class support for csproj files. Assembly Definitions will convert into csproj files and those will be consumed by Unity directly.