Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to edit 'Path ID' of assets? #333

Open
Daelomin2 opened this issue May 5, 2024 · 2 comments
Open

Is there a way to edit 'Path ID' of assets? #333

Daelomin2 opened this issue May 5, 2024 · 2 comments

Comments

@Daelomin2
Copy link

I am trying to figure out a way to add brand new bundles of a certain type to a game for modding purposes. The only realistic way to do this is to modify the assets of an existing bundle to reflect the changes wanted for the 'new' bundle.

This process works perfectly in the game, EXCEPT for when the entity related to the 'new' bundle is loaded in a scene that contains the entity of the 'source' bundle: the game only loads one of the bundles and then prints an error to the log saying that the other bundle "can't be loaded because another AssetBundle with the same files is already loaded".

Unless I am mistaken, this error is occurring because both AssetBundles contain matching files with the exact same Path IDs. What I would like to try is to (using dumps and Pythin scripts) change all the Path IDs of the assets within the bundles to new Path IDs, and then edit all internal references to reflect the new Path IDs of the assets. I can edit the referenced Path IDs in individual Assets easy enough... but I can't seem to find a way to edit the Path ID itself of any given Asset within the bundle.

I hope this makes sense!

@Daelomin2
Copy link
Author

I should note that there is an "AssetBundle" asset within the bundle that contains all asset Path IDs referenced within the bundle (both internal and external) but editing the 'm_PathID' of an internal asset in this AssetBundle asset does not appear to update the 'Path ID' of the asset in question after saving and reloading the bundle.

Also, I have noted that it is possible to 'Add' an asset to the bundle and it appears I can set my own Path ID to any new asset, but when we're working with a bundle with 600 assets I'm really hoping I don't have to manually generate 600 new assets in order to get new Path IDs, rather than just edit the Path IDs of the existing assets!

@nesrak1
Copy link
Owner

nesrak1 commented May 5, 2024

That error happens when your bundle's assets file name is the same as one already loaded.

Picture a bundle like a zip file that holds a folder of assets called folder1, and even though you can copy file1.zip to file2.zip, the folder inside is still the same name as file1's, and when unity tries to "extract" the zip, it would overwrite the files in folder1.

When you have a bundle open (the main window with the dropdown and info button), you can click rename to rename the file to something else that doesn't conflict (usually something like CAB- but doesn't have to be). You might have some issues with Texture2Ds, AudioClips, Meshes, and other assets inside the assets file (colored purple in the dropdown) because they have strings that reference a .resS file or .resource file by name. Currently, the only solution to this is to batch export dump all of those assets, find and replace the CAB- names or whatever they're called, and batch import all of them again. This rename step is a planned feature for UABEANext in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants