#How to ship my Unity devtools package as DLLs, without prefabs breaking

1 messages · Page 1 of 1 (latest)

modern nimbus
#

My team have build a devtools package, which consists of code files (many of which are monobehaviours, many arent), prefabs, resources, other assets, etc. We want to be able to ship this as a package that can be imported into our customer's projects, where the code comes in the form of just DLLs, rather than raw .cs files.

I know the Library folder contains pre-compiled DLLs for each of my assemblies. When I want to ship the package, I'd ideally like to be able to just delete all my source files and assemblies, and replace them with their corresponding DLLs.

The problem with this is, once I do this, any prefabs that had mono behaviours from the deleted DLL break, since the prefab is trying to reference the raw .cs file version of the monobehaviour, rather than the one from the DLL. Now, I can still attach the DLL version of the monobehaviour to my gameobject (it shows up with a slightly different icon in the inspector, telling me its coming from the DLL rather than a raw file), but this means I have to reconfigure that component's inspector, to match the config I was using for the raw .cs version of the monobehaviour. In fact, I'd have to trawl through all of my prefabs, fix the monobehaviour references, and redo all the script config, every single time I want to do a new release.

For a small project this might be doable, but we're building a devtools package that supplies its own hot-swappable VR/2D player, each with its own movement and interaction systems, along with buttons, levers, grabbables, all with network tie-in so its all multiplayer, file systems, voice chat, UIs, etc etc. All too big in scope to feasibly be able to fix everything manually for each release....

#

I've seen some recommendations to build some editor tooling to automate this, I.E

  • Loop through all prefabs, capture the type names of any monobehaviours, also capture their config
  • Delete assemblies and scripts, replace with the corresponding DLLs from the library folder
  • Loop through all prefabs again, remove the now broken MB references, replace them with the MBs from the DLLs, and restore their config

The problem with this, aside from being a general pain in the neck, is that many of my prefab's monobehaviours themselves reference other monobehaviours, that'll also need fixing. This means my script needs to make sure it's handling all these MBs in the correct order, doing the ones that don't have any MB dependencies first, and then traversing through the hierarchy appropriately

In theory doable, maybe? But all this is starting to seem like much more trouble than it has any right to be.

Surely there's some pipeline for this? How do dev teams typically convert their projects' prefabs into shippable versions that only use pre-compiled code?

Cheers!
Fred

candid forge
#

afaik this is generally why most packages just provide the scripts