Jump to content

[Tutorial] How to edit assets and assetbundles.


Recommended Posts

This is a 2nd level Tutorial on how to edit assets and assetbundles.

 

Tools
- Unity Assets Bundle Extractor
https://7daystodie.com/forums/showthread.php?22675-Unity-Assets-Bundle-Extractor
- Text editor (e.g. notepad++)
- Asset Studio
https://github.com/Perfare/AssetStudio/releases
- paint, gimp, photoshop, paint3d, blender

0. What is a 2nd level Tutorial?
PoE2 has three levels at which one can mod the game. Level 1 is modifying the gamedatabundles, stringtables etc. Let's call it scripting and shuffling of existing things. You can't add totally new stuff or change the game mechanics. Level 2 allows you to add self made contend (new npcs, new hairstyles, new look etc.) just like a DLC. Level 3 is changing the game mechanics. In other games this is called the "hard coded" level and is normally not accessible to moders.
Level 1 has no influence on level 2 or 3. Level 2 has no influence on level 3 but on level 1. Level 3 has influence on level 1 and 2.

1. What are assets and assetbundles?
The Unity engine stores all files required to display anything in the game (animations, areas and character meshes, some scripts, visual maps, variable lists e.g. for companion stats) in so called assets and assetbundles. The asset files are the "levelxy" or "sharedassets" in the "PillarsOfEternityII_Data" folder. Assetbundles are the unity3d files in the "PillarsOfEternityII_Data\assetbundles" folder.
The "levelxy" and "sharedassets" contain mainly areas and maps and the interaction between all the stuff on it (npc, quest and sequence triggers). So if you want to edit/build maps this are the once you need to get familiar with. The assetbundles in "PillarsOfEternityII_Data\assetbundles\streamtile" contain the textures for the areas and maps.
The focus of this tutorial will be the assetbundles in "PillarsOfEternityII_Data\assetbundles". The contain the stats and appearance files for all items, characters, creatures and the UI. They have mostly convenient names. The ones that start with "lax" are the expansions and DLC's.

2. How to mod assetbundles?
2.1 UABE and Asset Studio
In order to modify assets or assetbundles you need Unity Assets Bundle Extractor (UABE). It is the only tool I know, which can import files into existing assets or assetbundles. UABE is not very helpful for browsing the files. This is where Asset Studio shines. It can give you previews of files without the need for extraction and external programs.

2.2 Things you need to do, before start modding.
The big unity3d files are "compressed"!? Not really, but you will have to "uncompress" them. UABE has a protection build in to prevent unwanted overwrite. To make your life easy just do this ALWAYS!!! when modding an assetbundle.

- take the unity3d file you want to "uncompress" or mod and name it name2.unity3d
    e.g. characters.unity3d --> characters2.unity3d
- open characters2.unity3d in UABE via File -> open
- if you haven't "uncompress" the file you will be prompted to do so.
- save the file as characters.unity3d without the number.

Now you have two files, a backup with a number and one modded, which is used by the game.
PS: there is no need to "compress" those files.

2.3 The file structure inside the assets or assetbundles.
Use UABE or Asset Studio to open the assets or assetbundles. You will see many different file types. If you already know, how to mod gamedatabundles, you will recognize monobehavier files with "prefab" in their names. This prefab files are text files containing, how all the other files are put together. They are the assembly instructions.  

Here is an example, I will use in this tutorial. It's the prefab for the female Godlike head 1. Practically all visual object prefabs can be found in "items.unity3d".

 

PPtr m_GameObject
int m_FileID = 0
SInt64 m_PathID = 0
UInt8 m_Enabled = 1
PPtr m_Script
int m_FileID = 0
SInt64 m_PathID = -5827726737468822885
string m_Name = "a_F_GODM_Head01"
FBXModelData ModelData
string Model = "Assets/Art/Character/Female/HUM/Head/GODM/F_HUM_GODM_Head01.fbx"
UInt8 ClearOutModel = 0
string UnityAssetGuidString = "1649bda68fd654b48b640253c80dbc2a"
string OriginalModelPath = "Assets/Art/Character/Female/HUM/Head/GODM/"
string OriginalModelName = "F_HUM_GODM_Head01"
string ModelSuffix = "GODM_Head01"
string ModelBaseFolder = "Assets/Art/Character/"
SubMeshSettings SubMeshes
Array Array
int size = 3
[0]
SubMeshSettings data
string MeshName = "F_GODM_Head01"
PPtr<$Material> MaterialOverride
int m_FileID = 1
SInt64 m_PathID = 8442848947353014589
MaterialState OVSMaterials
Array Array
int size = 0
int SubMeshType = 0
vector SpecificToSubRaces
Array Array
int size = 0
int VFXMeshTag = 0
UInt8 Hidden = 0
UInt8 IsEmissive = 0
[1]
SubMeshSettings data
string MeshName = "F_GODM_Head01_Eyes01"
PPtr<$Material> MaterialOverride
int m_FileID = 1
SInt64 m_PathID = 7764603257363938399
MaterialState OVSMaterials
Array Array
int size = 0
int SubMeshType = 0
vector SpecificToSubRaces
Array Array
int size = 0
int VFXMeshTag = 0
UInt8 Hidden = 0
UInt8 IsEmissive = 0
[2]
SubMeshSettings data
string MeshName = "F_GODM_Head01_Horns"
PPtr<$Material> MaterialOverride
int m_FileID = 1
SInt64 m_PathID = -7972597978955064533
MaterialState OVSMaterials
Array Array
int size = 0
int SubMeshType = 0
vector SpecificToSubRaces
Array Array
int size = 0
int VFXMeshTag = 0
UInt8 Hidden = 0
UInt8 IsEmissive = 0

FBXModelData FemaleOverrideModelData
string Model = ""
UInt8 ClearOutModel = 0
string UnityAssetGuidString = ""
string OriginalModelPath = ""
string OriginalModelName = ""
string ModelSuffix = ""
string ModelBaseFolder = ""
SubMeshSettings SubMeshes
Array Array
int size = 0
FBXModelData LowPolyModelData
string Model = ""
UInt8 ClearOutModel = 0
string UnityAssetGuidString = ""
string OriginalModelPath = ""
string OriginalModelName = ""
string ModelSuffix = ""
string ModelBaseFolder = ""
SubMeshSettings SubMeshes
Array Array
int size = 0
FBXModelData LowPolyFemaleOverrideModelData
string Model = ""
UInt8 ClearOutModel = 0
string UnityAssetGuidString = ""
string OriginalModelPath = ""
string OriginalModelName = ""
string ModelSuffix = ""
string ModelBaseFolder = ""
SubMeshSettings SubMeshes
Array Array
int size = 0
PPtr<$CharacterModelVisualData> PartialModelVisualData
int m_FileID = 0
SInt64 m_PathID = 0
UInt8 HidesHair = 0
UInt8 HidesFacialHair = 0
UInt8 PartialHair = 0
UInt8 MoveEars = 0
float OverrideScale = 0
vector HidesSubMeshTypes
Array Array
int size = 0
PPtr<$Texture> CharacterCreationThumbnail
int m_FileID = 0
SInt64 m_PathID = 1803577024755730608
VisualEffectModifiersGameDataReference VFXModifiers
string GuidString = "00000000-0000-0000-0000-000000000000"

 

 

It looks like a lot, but it is more simple than it seems. If you want to change the appearance of anything in the game the cyan part is the most important. The locations of all necessary files are under "FBXModelData ModelData". The strings are all references to files in characters.unit3d. The next important part is "SubMeshSettings SubMeshes". Here are the meshes used and under "MaterialOverride" is the reference of their color files. When you open those meshes and material files, you will see the same structure and references to object (fbx), skeleton, and texture files.

2.4 Referencing in the assets or assetbundles
I have used the term reference very often in the previous section. There are 3 ways to reference something in the assets or assetbundles.

    1. Reference by name (eg. string MeshName = "F_GODM_Head01")
    2. Reference by SInt64 m_PathID. When you open an asset or assetbundle in UABE and click on "Info" a window called "Asset info" with all the files in the asset will open. In this Window there is a tab called "PathID". This is the SInt64 m_PathID of the file. If you want to find a file mentioned in the prefab or other files, copy SInt64 m_PathID, open the "Asset info"-window of the asset, click on view, select file id (there is only one), fill in the path id and click ok to find the file.
    3. In some cases we have files referenced across assets and assetbundles. The prefab files are in items.unity3d and reference to characters.unity3d. I have not figured out yet, how this is done. Presumably it has something to do with a file in every asset with the path id 1 and/or the "UnityAssetGuidString".

Edited by Fhav6X
  • Like 3
Link to comment
Share on other sites

3. Time to mod!
I will now mod the female Godlike head 1 to look a little different.

3.1 Rename items.unity3d (if you have not "uncompressed" it), characters.unity3d and character_headandskin_hd.unity3d. I named them items3.unity3d (if you have not "uncompressed" it), characters3.unity3d and character_headandskin_hd3.unity3d.

 

 

akCK2N6.jpg

 

 

3.2 Make a work folder somewhere.
3.3 Open UABE -> open items3.unity3d -> save the "uncompressed" as items.unity3d -> open items.unity3d -> click info -> resize "Asset info" to your liking -> look for MonoBehaviour a_F_GODM_Head01 -> click "Export Dump" -> save the file in your work folder. The file name contains the Assets md4 hashed name and the Path id (none negative).

iRmlfDp.jpg



I won't change and import a_F_GODM_Head01 back. But it is easier to look up the SInt64 m_PathID this way. If you wish to use different/custom models you have to edit this file too.

3.4 I will only change the colors of the actual head, so I just need the SInt64 m_PathID from

        string MeshName = "F_GODM_Head01"
        PPtr<$Material> MaterialOverride
            int m_FileID = 1
            SInt64 m_PathID = 8442848947353014589
            
3.5 Open UABE -> open character3.unity3d (mine is already "uncompressed") -> click info -> resize "Asset info" to your liking -> click on view -> select "go to asset" -> fill in the file id and under path id 8442848947353014589 -> click "View Data" -> a window will pop up.

Material files are like prefabs for texture. I will not edit this file, just the textures it references.

3.6 In the window expand to "UnityPropertySheet m_SavedProperties/map m_TexEnvs/Array Array/2/_MainTex and note the SInt64 m_PathID = 8053650484694347279.

 

 

0lfMzhW.jpg

 

 

3.7 Now look for this file via "go to asset" -> click on "Plugins" -> select "Export to .png" -> save the file in your work folder. DO NOT CLOSE UABE!!!! Well, you can close it, but it's easier this way.

 

 

Y2A9CqT.jpg

 

 

3.8 Edit the file to your liking. I use gimp for that.
3.9 With UABE still open and pointed, at the file click on "Plugins" again -> now select "Edit" -> a new window opens -> click on "Load" under "Texture" -> select your edited file -> confirm everything.

I want to give the moon godlike the horns of a nature godlike. For that I will replace the horns object files.
3.10 Look for F_GODN_Head02_Horns in character3.unity3d (there are models for each race) -> select all of them and click "Export Dump" -> now look for F_GODM_Head01_Horns click "Import Dump" and import F_GODN_Head02_Horns for the corresponding race.
3.11 In the "Asset info" window select "File" -> save -> OK -> "Asset info" closes.

 

 

 

YOz46IG.jpg

 

 

3.12 In UABE select "File" -> SAVE!!! (not export) as "character.unity3d" without the extra number from before.

 

 

bbOoFiD.jpg

 

 

PoE2 has extra hd textures in character_headandskin_hd.unity3d so I will edit those too. The textures have the same name as the ones in characters.unity3d but with a "_HD" at the end.

3.13 Open UABE -> open character_headandskin_hd3.unity3d and repeat Step 7 to 11.

Almost finished.

3.14 Launch PoE2 and go to character creation.

 

 

VvXJ8je.jpg

 

 

4. FAQ
Q: Can we create own files?
A: Yes and no. There is currently a problem in UABE with new MonoBehaviour files like the prefabs, that prevents creating entire custom things. Any other file type can be created.

Q: Can we make install packages?
A: Yes, UABE offers this. I recommend to make a readme with all edited SInt64 m_PathIDs for mod compatibility.

Edited by Fhav6X
  • Like 4
Link to comment
Share on other sites

Thank you for this tutorial! 

 

I wanted to change the skin tone of godlike and I imagine I should be able to do that just by altering the texture as you did. 

 

If I wanted to switch a model for another how would the process work? UABE doesn't export obj, right?

  • Like 1
Link to comment
Share on other sites

Thank you for this tutorial! 

 

I wanted to change the skin tone of godlike and I imagine I should be able to do that just by altering the texture as you did. 

 

If I wanted to switch a model for another how would the process work? UABE doesn't export obj, right?

 UABE can do this the same as with pictures. But for swapping models, you just have to redirect the paths in the prefab, or (for single parts) replace the model files, like I did in 3.10 and 3.11.

 

As soon as I figure out, how to create prefabs, I will make a tutorial for entire custom models.

 

Skin color change can be done by editing the material files of the models. They have sections called "_TintMap", "_TintColor1" and "_TintColor2". If there is no file for the "_TintMap" you can just enter the color numbers for your color under both "_TintColor1" and "_TintColor2". The color numbers for red green and blue are the rgb numbers of a color (look them up in paint) divided through 255.

  • Like 2
Link to comment
Share on other sites

So using this method it is currently not possible to ADD new items/armors/weapons using this method because of problems with creating new Monobehaviors? Am I understanding this right? What is the problem exactly with creating new Monobehaviors/Prefabs for use in the game? Could you just copy an existing one and modify it or would that also not work?

Link to comment
Share on other sites

There are multiple types of Monobehaviors. When a new one is created in UABE, the program reverts it always to the default type of these and in so doing, cutting off areas needed for the extra information of the prefabs.

 

There might be a way to "add" new items/armors/weapons. I have seen a lot of poe1 stuff in the bundles. One could recycle those for new things in poe2.

  • Like 1
Link to comment
Share on other sites

@Fhav6x

 

I have sucessfully edited a soulbound weapon's .unity3d file (using UABE and Notepad++) to include an additional class (Druid).

 

I have imported the change I made (using Notepad++) back into the original .unity3d asset bundle.

 

But upon exporting that new file all I get is a "file" extension, that is, a file with no .unity3d extension.

 

So my question is, how do I get that newly edited asset bundle to be recognizable and usable by PoE as a legitimate .unity3d file?

 

*EDIT*

 

I figured it out :)

 

What I wasn't doing was saving the renamed .unity3d file as the originally named PoE file WITH THE .UNITY3D extension FIRST, before dumping what I wanted to edit and then importing those changes.

 

I was using the "export" option instead and the game would not recognize the file even if I tried to add the .unity3d extension after making proper edits using the export option.

 

Very easy to mod now!

Edited by blackstone777
Link to comment
Share on other sites

I have now marked under 3.12 that you have to save and not export the finished file.

 

If you do it as I suggested you just have to mark the numbered unity3d file when saving and remove the extra number. This way you always correctly name the file and file extension.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

I just started using these mod tools today, thank you for sharing them. I am halfway through editing Maia's appearance. I successfully edited the character_headandskin_hd.unity3d file, but when I go to edit the characters.unity3d file, it crashes the AssetBundleExtractor. I can only open the file, but as soon as I click "Info," it crashes the program. Any idea what to try?

Link to comment
Share on other sites

  • 9 months later...
  • 4 weeks later...

I'm trying to modify Ydwin's prefab MonoBehavior so that she has more than 10 Might. I can get into the CharacterStatsMutable script, and I can export the dump file version of it, and edit it. However, when I try to import it back in, it loses everything below the m_Name = "" variable of the file. It even happens if I don't modify the dump file at all and try to re-import it. In doing some experimentation, I suspect this is because the variable after it is a custom type. I'd try to edit the raw .dat file, but I don't know how to do that.

I can modify the actual string m_Name = "" variable, setting the string and everything, but interestingly, if I try to rename the variable to string m_notName, it reverts back to the m_Name. I suspect this is because "m_notName" isn't an expected variable, and also because m_Name is an actual default Unity object variable.

Has anyone had any luck with modifying character attributes (not skills / respeccing)?

 

(apologies if this is a double post)

Link to comment
Share on other sites

A mono loosing data ... That sounds like you are using an old uabe version (2.2a and older). If it is v2.2d, try it with 2.2c or 2.2b.

Sometimes you have to restart uabe to show modded data. So after importing just close the programm and restart.

Don't bother editing the raw files. It will only lead to more problems.

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...
  • 3 weeks later...

Hello everyone,

I hope someone can help me because I did not find anything on the net to solve my little problem,
I will try to be as clear as possible ...

I would like to put the main character of one game in the other, it's 2 android games made with Unity.
This is what i did ...

Programs used :

-AssetStudio

-AssetsBundleExtractor

I extracted the 2 APKs with Winzip to have the structure :

(see pictures below)(1)

I was therefore able to find the 2 "Models" in the 2 games, example :

(see pictures below)(2)
I imported the "Mesh" (.obj) from one game to another in .dat format by importing the "Raw" and "Dump" and converted everything back to APK:
(see pictures below)(3)
The problem is that in the game I don't see my character, he is there because I can run and move around in the game but he is invisible after my modification.
(see pictures below)(4 and 5)
I don't understand why, someone would have an idea ?
the last picture is the "Models" I wanted to import into the game above (picture 4 and 5) :
Please please plese, help me !!!
if anyone wants to try just to see if it's possible, 
here are the links :

https://apkpure.com/super-girl-superhero/com.eventualsol.supergirlhero/download?from=details

https://apkpure.com/fr/amazing-hero-girl/com.bestsimgames.AMHG/download/2-APK

take the main character of "Supergirl Superhero_v1.0" (the first "SuperGirl) 

and put it in "Amazing-hero-girl V2.0.0" to replace the main character 
with the cape and the texture if it's possible

02.jpg

04.jpg

05.jpg

10.jpg

11.jpg

12.jpg

Edited by Jeffaxer
  • Like 1
Link to comment
Share on other sites

  • 10 months later...
On 11/16/2019 at 5:18 AM, Fhav6X said:

A mono loosing data ... That sounds like you are using an old uabe version (2.2a and older). If it is v2.2d, try it with 2.2c or 2.2b.

Sometimes you have to restart uabe to show modded data. So after importing just close the programm and restart.

Don't bother editing the raw files. It will only lead to more problems.

ola estou com mesmo problema do jeffaxer   queria troca um personagem de um jogo pra outro... 

0 MonoBehaviour Base
 0 PPtr<GameObject> m_GameObject
  0 int m_FileID = 0
  0 SInt64 m_PathID = 0
 1 UInt8 m_Enabled = 1
 0 PPtr<MonoScript> m_Script
  0 int m_FileID = 0
  0 SInt64 m_PathID = 
 1 string m_Name = 
 1 string meshName = "Male_Top_Cos_Nutcracker"
 0 vector animatedBoneNames
  1 Array Array (0 items)
   0 int size = 0
 0 vector animatedBoneHashes
  1 Array Array (0 items)
   0 int size = 0
 0 UMAMeshData meshData
  0 vector bindPoses
   1 Array Array (0 items)
    0 int size = 0
  0 UMABoneWeight boneWeights
   0 Array Array (0 items)
    0 int size = 0
  0 BoneWeight unityBoneWeights

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...