Small excursion about external materials and textures - enimaroah-cubic/Sb3UGS GitHub Wiki
The files are taken from Honey Select release version, but the principle applies to all Unity based games.
Load cf_shorts_04.unity3d and open Animator p_cf_shorts_11_00.
Select Mesh cf_O_shorts_d and note the message in the Log window:
cf_O_shorts_d[0] has an external Material FileID=1 PathID=-4868027318105399293
Unselect the Animator. Nothing should be selected now.
From the file's Options menu click "View Data". Last lines of the output are:
References
FileID=1: guid=00000000-0000-0000-0000-000000000000 type=0 filePath="" assetPath="archive:/cab-05785cb2276d2d34983aef7c43515e6e/cab-05785cb2276d2d34983aef7c43515e6e"
Search in the whole **abdata **folder for that Cab-String "CAB-05785cb2276d2d34983aef7c43515e6e" or limit your search to the files at the end of "Dump AssetBundle". You will find many files with that CAB-String (all ending _04) if you search case insensitive! If you do it right then you will find mat_cha_04.unity3d. Drag it into Sb3UGS.
Now refresh the Mesh by clicking it in the Mesh list.
Note two things:
-
The Material has been loaded and Textures too, because they are in the same file.
-
In the mat file more materials have been loaded (shown in bold face). But they are not available for selection yet. To use loaded resources either close and reopen the Animator or switch to the Object Tree and press "Refresh" at the bottom.
The grey foreground colour in the Object Tree marks external assets. Remaining question: why haven't all materials in that been loaded? The file with the shorts references only those four.
Select the material and use "Copy -> New".
Local assets are black. Externals are grey. This is important when using them and since they have the same name they are marked accordingly.
Note also that our shorts file got new tabs for Materials and Textures. This file didn't have any of them before and all types are registered.
Currently new types make this file invalid for the game! You get a message in the game's log file:
The AssetBundle '{your file path}' can't be loaded because it was not built with the right version or build target.
In this case you have to change the Inventory offset in the file's menu. - Fixed in SB3UGS_v1.2.7 and later versions.
Now remove the external material cf_M_shorts_11_00. The mesh shows up like at the beginning. Though you could switch to the new local copy.
Do something else instead and reload the shorts file! Two messages are shown in the Log:
The given key was not present in the dictionary.
Remember we have removed the material from the material file which is still in Sb3UGS. If you see this message then usually a file is broken. This can happen e.g. when you edit files standalone and Sb3UGS doesn't even know the referencing file.
Adding a Reference
The files are taken from Honey Select release version, but the principle applies to all Unity based games.
Start Sb3UGS and open ca_head_06.unity3d alone.
ca_head_06.unity3d has one external reference which is always shown checked.
If you open another file which is unreferenced then this will be added to the list unchecked.
Here mat_cha_02.unity3d has been opened.
Check that entry to link the current file with this file. The link is one way only. It points to mat_cha_02.unity3d in this case, but mat_cha_02.unity3d will not get linked to ca_head_06.unity3d. You will get a message for this in the Log window.
Open the "Material & Texture Animator" by double clicking some materials and/or textures in mat_cha_02.unity3d.
Switch to ca_head_06.unity3d, open Animator p_acs_head_veil_hut and select MeshRenderer acs_head_veil_hut_base. Open the selection for materials.
When you switch the material to such an external asset the material and textures are not copied into your file. You will not find a tab for Materials and Textures in your file. The submesh just references this material.