Custom model bundles - Raytwo/Cobalt GitHub Wiki

So, you need to make a new model bundle and you don't know how. Not a problem.

This page will assume you have gone through the project setup

Changing your project settings

Before importing your model, open the Player settings by selecting Edit > Project Settings at the top of Unity's window. Then pick the Player category on the left.

Click on Other Settings to open that section, and then scroll down to the "Optimization" group. Make sure that Optimize Mesh Data is unchecked.

Screenshot with Optimize Mesh Data being highlighted in blue and unchecked

Importing your edited model

Import your rigged FBX in your Unity project by dragging it in the Assets directory.

Select your new asset, and it should open in the Inspector tab. Set the Optimize Mesh dropbox to Nothing and uncheck the Convert Units box in the inspector on the right.

When you're done, click the Apply button (if you don't see it, you may need to scroll down in the Inspector).

Screenshot of the Inspector with the changes applied

If you are creating a custom oBody (map model), also need to set Avatar Definition to Create From This Model under the Rig tab.

When you're done, click the Apply button.

Screenshot of Rig with changes applied

Next, navigate to the Materials tab and change the Location option to Use External Materials (Legacy). A Naming dropdown should show up, which you'll set to From Model's Material.

Example of how to unlock materials for editing

When you're done, click on the Apply button at the bottom to confirm the changes.

[!TIP] If you would like to make these import settings the default for your project, you can click the slider button in the upper right of the panel and then click "Save current to".

.

Then select the resulting asset file, and click "Add to FBX Importer Default".

Now any future FBX files you add to this project will be imported with the same settings. To learn more about this Unity feature, see the Unity Documentation

Making it a bundle

Create the Share/Addressables directory hierarchy under Assets in your project filesystem if it does not exist already.

Screenshot of what the directories should look like

Once done, you need to replicate the directory hierarchy of the game for the prefab of your choice. Explaining how to figure this out is slightly difficult, but using CBT to dump a similar prefab and looking at the internal_path can be helpful.

Example: for Corrin's amiibo outfit, Unit/Model/uBody/Cor0AF/c000/Prefabs/ is one such directory you can make.

Screenshot of the directory hierarchy from the example

Now, drag your FBX asset from the Assets directory to a Scene in your project, and make sure to give it the same name as the internal_path (or a made up one if you intend to add the file to the game). For our example, you'd pick uBody_Cor0AF_c000.

Screenshot of the scene with the model imported

Once done, drag the root GameObject of your bundle, and drop it in the directory you made previously.

Screenshot of the asset in the correct directory and the proper name

Assign an Address to your bundle

Due to the game using the Addressables system (You may have noticed the Catalog.json/.bundle file in your dump), your bundle needs to be assigned an Address so the game is able to call it.

Select your freshly made bundle, and at the top of the Inspector you'll see a "Addressable" checkbox. Toggle it on, and then assign it an address fitting for its purpose.

To keep up with our Corrin example, your Address would be the internal_path used in the catalog, so Unit/Model/uBody/Cor0AF/c000/Prefabs/uBody_Cor0AF_c000.

Screenshot of the Address being assigned

Organizing your bundle for the game

Assuming you dumped an existing model to make your edits, your bundle should already have the proper hierarchy and GameObjects (most notably, the boneset).

Double click on your bundle, look at the Hierarchy (left dock) and make sure the base boneset (physics bones are optional) is present and correctly named for the animations to work properly. Meshes usually go under the meshGP object, but this is not mandatory.

Screenshot of a correct Hierarchy

Assigning game shaders to the materials

Before proceeding

You'll want to reproduce the shaders from the game in your project before taking on this step so they can be depended on. Please follow the shader replication guide to achieve this before continuing.

Once your shaders are ready, select one of the meshes in your bundle so you can see its components in the Inspector. By default, the Standard shader is assigned, so we'll need to change that.

Look for the Shader you'd like to apply in your project (we'll use CharaStandard here) and drag it on the Shader dropdown of the material in the Inspector. Assuming you did it right, you should see the following:

Screenshot of the shader being assigned

You can now display the properties of the Shader by clicking on the > symbol on the right of the dropdown, and assign textures and colors accordingly.

[!NOTE] Because there is currently no way to preview the material, refer to the materials of existing bundles for examples of values.

Example of a material with some textures set

Generating the files

Now that your bundle is ready to be created, visit the Addressables Groups tab at the bottom, pick the Build menu and generate a new build using the default script.

If you've already generated the bundle but need to redo this part, don't delete anything, just follow the instructions above like normal, Unity will replace the old files by itself.

Screenshot of the menu

Once that is done, you'll be able to find your built addressables in the Library folder of your Unity project, in (your unity project path)/Library/com.unity.addressables. For example, if you built for a Mac target, it might look something like this:

Next steps

Now, let's get your bundle ready for use in an Engage mod.

Sample projects

If you want a sample projects to study

  1. For models, check out the Pyra costume project, which was made following this guide!
  2. For weapons, check out the Raijinto mod