Advanced Project Setup - rspforhp/WildfrostModdingDocumentation GitHub Wiki

Assembly Stripping (Publicizing)

This part of the project set up is not necessary to do immediately. Come back later once you have read/done other things. Assembly stripping is meant to give you access to originally inaccessible (private) variables and methods.

  1. Find a trustworthy assembly publicizer (I used APublicizer) and download it.
  • You can download the pre-built application via a pinned message on the Wildfrost Discord's mod-development channel;
  • OR follow these steps to build it yourself
    1. Open its solution (.sln) in Visual Studio and head to the APublicizer class.
    2. Build the project (ctrl+B), this creates an application somewhere on your computer. If this is your first time building the project, the filepath of a nearby file should be given in the output window.

PublicizerBuild2


  1. Find this newly-made APublicizer application. Find your Assembly-CSharp file (which was found in an earlier section). Open the Assembly-CSharp with the APublicizer application. The easiest way to do this is drag the dll and drop it onto the APublicizer.

DragAndDrop


A command prompt window may pop up for a moment. Then, a new .dll will appear in that Managed folder: Assembly-CSharp-Publicized.dll. This .dll has the same structure as Assembly-CSharp.dll except all methods and variables are public.

Finally, in your mod project:

  1. Add Assembly-CSharp-Publicized.dll to your references.

  2. Right-click your mod project and go to properties. In the "Build" tab, check the box "Allow unsafe code".

  3. If your code overrides any protected methods such as Load and Unload, then change the access modifier from protected to public.

image


Unsafe code ignores access modifiers. So, your code can now read and write to private variables and use private methods as if they were public. Yay!

[!Note] If the game gets updated, you would want to make a new version of the publicized assembly. All you have to do is repeat step 2

Using Addressables (Very Advanced)

Once you've gotten used to using DataBuilders, you might wonder how to publish your mod with mod assets already created. The base game achieves this by using addressables created in Unity. You can explore these by opening the .bundle files from Wildfrost_Data/StreamingAssets/aa/StandaloneWindows64/ using the program Asset Studio.

In Tutorial: Using Addressables, we explore using addressables to compress image files into sprite sheets which end up saving storage space and loading time (by skipping the conversion from .png to sprites). The process for creating addressable CardData, StatusEffects, and other ScriptableObjects will still require the same Unity Project Setup.