Skip to content

Dynamic Skins Tutorial

RuneFox237 edited this page Apr 24, 2022 · 12 revisions

How to add dynamic bones to custom skins for playable characters in Risk of Rain 2

This tutorial assumes you already know how to create a skin using KingEnderBrine's Skinbuilder. If you do not already know how to do this, refer to these links:

Required Tools/Materials

  • Blender (version 2.9 or higher)
  • Unity (Version 2019.4.26)

Setting up the model in blender

Note: I suggest you make a working skin with your mesh and the normal armature for the character you're making the skin for before attempting to make a version with Extra bones as it will make debugging your skin easier.

There are two ways to add dynamic bones to a model.

The first is to add the bones directly to the base armature. This is used to add physics to parts of the base mesh, things like tails, ears, hair(as part of the same mesh), breasts, etc.

We will call these 'Internal Modifications' An example of that looks like this: I usually name the start of these new bones with "Base" so I can easily find them later

The second is to add the bones to a additional mesh that will be attached to the character later. This is used for things like clothes, capes, hair(as a separate mesh), etc.

We will call these 'External Modifications' An example of that looks like this: Notice how the skirt is a separate mesh from the base model.

NOTES:

  • The position of the root bone of the armature for this mesh needs to match the position of the bone we will be parenting it to on the base model.
  • The armatures for these needs to have the word 'Armature' in it somewhere, the script uses this to easily find the armature when needed

!! WARNING !!

Potential Issue: Some characters have weapons that are weighted to bones in the character's armature, like Huntress' bow or Railgunner's Backpack and Rifle. If you are modding a character like this then you will need to also export these meshes from your modified model file as it will have the correct bone positions. Otherwise the weapon may end up skinned to the wrong bones.

Make sure your mesh has been weighted with the new bones and then export it the same way you would for any other custom ror2 skin.

Working in Unity

Set up your skin using KEB's skinbuilder. Follow all the steps up to and including the Build step but do not test your mod. Due to the additional bones in your new armature the skin will look broken in-game until we add back in the bones using the DynamicSkinsBuilder

Importing DynamicSkins

To import DynamicSkins you'll need to open the Unity Package Manager. On the Top Bar of Unity Navigate to Window->"Package Manager" A separate window should appear.

Hit the "+" in the top left of this window and select "Add package from Git URL".

Paste the line below into the field that appears and hit add

https://github.com/RuneFox237/DynamicSkins.git

Unity will import the package. There will be errors in the console upon importing the package. This is normal and we will go over how to fix them below.

Go to the top bar of Unity and open Edit->Project Settings. Navigate to Player->"Other Settings"->"Api Compatibility" and set it to ".NET 4.X". Exit out of that window when finished

Check the Console for Errors, if you hit clear and the only errors that show up are errors that look like the ones below then we are good to move on to the next step.

  • Errors that state "Could not load signature of ___ due to: Could not load file or assembly ____"
  • Errors that state "Unloading broken assembly ___, this assembly can cause crashes at runtime" These errors are from KEB's skinbuilder and do not cause any issues. In my testing there has usually been around 5 of them.

Setting Up the Prefabs

You will need to create prefabs of the new bones/meshes that will be loaded into the game alongside the base model. Each modification only supports one prefab and one Dynamic Bone.

NOTE: Make sure to name your Prefabs something easy to find later

Drag and drop the model into the hierarchy view, right click on it and click 'unpack completely'. Next, we need to find the modifications we made and make them into prefabs. Each modification will require it's own prefab.

For Internal Modifications, the prefab should consist of just the bones that were added to the base. So just select the root of the new bones and drag it into the Project window to create a prefab.

For External Modifications, right click and click 'Create Empty'. Select and drag the armature and mesh for the modification into this new object to parent them to it and drag the object into the Project window to create a prefab.

NOTE: Make sure to replace the material used by the Mesh Renderer on the mesh for these modifications with a material using the RoR2 shaders

The end result should look something like this:

In this example the Breast and Butt Prefabs are for Internal Modifications, The Skirt and Accessory are External Modifications. Note how they are separate from the main armature and contain both their own armature and mesh.

Set up your DynamicBones

DynamicSkins comes with a modified version of DynamicBones. If you've used DynamicBones before it will look very familiar.

I won't go into detail about how to set up dynamic bones as there are many tutorials online for that, though I will give some notes for setting it up in the context of this specific application

  • Add the Dynamic Bone scripts to the head of the prefab it is for, this will allow you to easily find and identify it again later.
  • The DynamicSkins Script doesn't fully support the distribution curves yet. It imports the position of the keyframes, but the weighting and tangents will likely be off
  • The DynamicSkins Script does not support distance disable yet.

Setting up DynamicSkins

Add the Dynamic Skin Info component to the root object of the model in your scene hierarchy.

In the Dynamic Skin Info component set the Mod Info field by either dragging them from the project window or clicking on the target next to the field and selecting them from the list that appears

Open the Dynamic Modifications list and input the number of modifications you have. This will match the number of Prefabs and Dynamic Bones you have. For each Modification fill out the fields.

Prefabs you select from the prefabs you saved by adding the to the Assets folder earlier in the process. You can access them by clicking on the target next to the field and selecting the assets tab in the list that appears

Dynamic Bone you select from the ones in the Scene. You can access them by clicking on the target next to the field and selecting the scene tab in the list that appears, or you can drag them from the hierarchy onto the field.

Parent Bone is the object that the prefab is attached to in the hierarchy. You select it from the objects in the scene. You can access them by clicking on the target next to the field and selecting the scene tab in the list that appears, or you can drag them from the hierarchy onto the field.

Skin Def you select like the ModInfo above. By either dragging them from the project window or clicking on the target next to the field and selecting them from the list that appears.

Affects Base Model is whether or not the modification is an Internal or External modification. Toggle it ON if your modification is Internal and keep it OFF if your modification is External.

Example Final Dynamic Skin Info

When you are done filling in all the fields hit "Build" in the Dynamic Skin Info. If everything works correctly you should see DynamicSkin Finished in the console. Check for any additional errors that are different from the ones that were stated as safe above.

There will also be a warning about inconsistent line endings, this can also be ignored. If there are any other errors, they may signify that the process did not complete correctly. You can still try and build the main skin mod but it may not work correctly.

After you have built the DynamicSkin you can go back to the Mod Info for your mod. Check that the Additional Resources list on the Mod Info has the prefabs from the Dynamic Modifications added to it. If not you will have to add them manually. After that is done, hit the "Build" on the Mod Info. This should build the mod dll with the dynamic skins included. Now you can import the mod into RoR2 to test and see if it works.

Troubleshooting

I'll list some common issues that I came across when working on this and how to fix them.

1. Model looks like a stick figure when I load it into the game:

Check the Convert Units checkbox in the Import settings of the model, try toggling it on/off and trying to build the mod again.

2. My Model isn't appearing in game:

Check that you spelled the names of the prefab, parent bone, and body name correctly. There will usually be an exception in the debug log if the mod failed to find any of these

3. Help, my mesh is all tangled looks like this!

This is likely caused by a mismatch between the bone order the mesh expects and what we gave it. Open the prefab of the modification that has the issue and try reordering the bones in the place where the armature splits into multiple children and trying it again.

Also check out the page for Common Mistakes When Using DynamicSkins

If you come across any other issues or have some questions about DynamicSkins feel free to ask me on the Risk of Rain 2 Modding Discord. My username there is Minicooper237#4923

Clone this wiki locally