How to create an AssetBundle for ModularWeapons
Added 2022-11-08 07:36:35 +0000 UTC
Gunsmith system of ModularWeapons requires specially formatted texture files. So we need AssetBundles to prepare it.
Step1: Install Unity to your device.
From here; https://unity3d.com/
I recommend the same version of Unity as Rimworld, but it doesn't seem to have to be exactly the same version. I use 2019.1.14f1.
Step2: Create a project and import assets.
No needed to change any settings when creating a project.

Then, import all texture files into Project window. Like this;

Don't forget "Base" texture. This will be the base of the image drawn with the modular weapon.
And change settings of all texture files at the Inspector window like this;

- Put a check mark in "Alpha Is Transparent".
- Put a check mark in "Read/Write Enable".
- Change "Filter Mode" into "Point (no filter)".
- Set "Compression" into "None".
- Set name of AssetBundle. (BOTTOM of them! DON'T FORGET!)
Step3. Compress into AssetBundle file
Compressing into AssetBundle is not a standard function of Unity. You need to create editor extension.
I used this as a reference. https://orenda.co.jp/blog/1633/ (sorry, this is Japanese article)
EDIT: I have included the script as an attachment to this article. Put this in an Editor file in your project.
Step4. Put your AssetBundle into your mod
Explanation is done! Well done!
In the next post, I will explain the file structure of mods that add modular weapons!