Skip to content

Small excursion about external materials and textures [Part_1]

enimaroah edited this page Feb 26, 2020 · 9 revisions

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 ExternalMatsAndTexs-01 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"
ExternalMatsAndTexs-02 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. ExternalMatsAndTexs-03

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. ExternalMatsAndTexs-04 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". ExternalMatsAndTexs-05 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. ExternalMatsAndTexs-06 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.