SpaceRTS - Starter Pack  1.2.4
DLL Replacer

This is a step by step with the description about how to safely replace the dll files with it's source code.

Overview

This is a feature that was in my head for a while, some way to replace the encapsulated core libraries with it's source code. The problem? It seems Unity has serious problems to realize that the monobehavior that once has been into the dll is the same that is now as a plain c sharp file in the project structure.

The solution was to write my own parser that collects all the monobehaviors in the dll (i mean fileID and GUID) save all that data and use it later to replace all the references in the whole project with the references to the loose files. (too technical?, doesn't matter, just follow the steps and your are going to be OK)

Some advice

Make a copy of your entire project. This is very important! we are going to access and change directly on the .meta files. A single error and all your project can turn into a complete mess up. Please be aware!

Extra Advice: This feature it's available from version 1.2.4 and beyond.

1. Download the source files

Go to the download section in my main website, let me take you there: Link
There you need to introduce your invoice number (should be sent to you by unity at the moment you purchased the SpaceRTS Starter Pack).

dll_replacer_00.png

A few seconds later a link should appear above letting you download the package. (In fact it will lead you to the drive folder where you can choose the library sources according to the SpaceRTS version that you are using right now) Download it. But wait, don't import it in the project right know, you need to do the next step first.

2. Prepare the DLL Replacer

Select the "NullPointerCore" dll in the project Window. Right click and select "Generate DLLReplaceInfo".

dll_replacer_01.gif

A Message box will appear with a warning. Click "Got It" button.

dll_replacer_02.png

A new Asset is generated now, located at the same directory of the dll. It contains all the needed info to replace the dll files.

dll_replacer_03.png

Now you can remove safely the dll and import the package NullPointerCore LibraryFiles vX_X_X that you downloaded in step 1.

Wait! You Removed both dlls and imported the package and still has errors? It's because you need the final step!

3. Fix the Project

Select the generated asset called NullPointerCoreInfo and look at the inspector, There is a button called "Rebuild GUID References", click it and that's it. Clear the console. You can now check out the entire project, now all the core scripts are referencing the loose monobehaviors instead of the ones in the dll (The dll isn't there anyway)

Conclusion

The bad news it's that you can't have the dll and the sources at the same time, and I don't know what is going to happen when you try to update Space RTS with a new version, you probably are going to loose that too, maybe you can use only if you are sure that don't want to update any more. or perhaps you can apply the same procedure again. That's uncharted lands I'm afraid.