UABEA icon indicating copy to clipboard operation
UABEA copied to clipboard

Game become slow in loading after replace a files

Open rna98mod opened this issue 2 years ago • 11 comments

i tried to replace mesh file in this game, the game files is in .unity3d format. I managed to uncompressed the data.unity3d file, then export the files i need (resource.assets). After importing/replacing the files i wanted, i import the files (resource.assets) back to the uncompressed data.unity3d. Modding process have no issue and no error, but when the files applied to the game, it become slow when loading a files and need about 1-2 min to just load another stuff (e.g change and choosing car in garage menu), but it works, the game read the files, just become so slow.

original Screenshot_2023-02-05-00-17-56-435_com fengiiley frlegends

modified Screenshot_2023-02-04-23-26-04-216_com fengiiley frlegends

this only happen when using the modified files. When i tried using original files (compressed and not compressed) the game works flawlessly.

the game uses Unity 2020.3.43f1c1, platform Android.

There's some difference when i compare the original uncompressed data.unity3d with the one that i modified image

original uncompressed data.unity3d size = 342.032 kb modified uncompressed data.unity3d size = 342.003 kb

rna98mod avatar Feb 04 '23 17:02 rna98mod

Modding process have no issue and no error, but when the files applied to the game, it become slow when loading a files and need about 1-2 min to just load another stuff (e.g change and choosing car in garage menu), but it works, the game read the files, just become so slow.

Is the game lagging all the time or just taking long to load certain screens? I haven't had anyone report that, although if you change a Texture2D, I still don't support mipmaps yet, so you could have poorer performance all the time (although that game looks to have simple graphics so I'm not sure). I can't really tell by your screenshots what you want me to see, nor do I know what you changed, so it's hard to help you diagnose the problem.

There's some difference when i compare the original uncompressed data.unity3d with the one that i modified

The original uncompressed version is showing a file where all of the LZ4 blocks converted into multiple uncompressed blocks (what UABEA does during decompression.) The modified bundle shoes a file where there's a single uncompressed block. There's no real difference on how it behaves other than how it looks in the hex editor and maybe a slight performance hit in the blocked version.

nesrak1 avatar Feb 06 '23 14:02 nesrak1

Is the game lagging all the time or just taking long to load certain screens? I haven't had anyone report that, although if you change a Texture2D, I still don't support mipmaps yet, so you could have poorer performance all the time (although that game looks to have simple graphics so I'm not sure). I can't really tell by your screenshots what you want me to see, nor do I know what you changed, so it's hard to help you diagnose the problem.

the game is not lagging (drop fps), just taking long time to load every scene, not just scene but also when loading a gameobject, i only try to change a Mesh asset in this case.

rna98mod avatar Feb 13 '23 16:02 rna98mod

I haven't heard of this one, but since you said the non-compressed file worked fine but only loaded slow when rewritten, it could be that the engine tries to load the whole file at once instead of the individual blocks. Maybe if you recompress the modified bundle to LZ4, it will speed back up? That would put the block chunks back.

But again, I've not heard of it taking significantly longer to load in game, so I'm not entirely sure.

nesrak1 avatar Feb 14 '23 00:02 nesrak1

I have tried to recompress the modified bundle to LZ4, and the result still the same.

I tried to re-import the extracted file (without modify it) to the bundle, recompress, and apply it to the game, and the result is the same, took long time to load a scene.

Here's the step i did :

  1. Open data.unity3d
  2. Extract it to file/memory
  3. Export a file from the bundle (in this case, i extract resource.assets from the data.unity3d bundle)
  4. Import the extracted file back to bundle
  5. Save the bundle into different file name
  6. Open the new saved bundle file
  7. Compress it with LZ4
  8. Copy and apply the compressed bundle to the game

With this step, although i didn't change any mesh or any assets, the game would still take long time when loading.

rna98mod avatar Feb 16 '23 14:02 rna98mod

You said the bundle uncompressed is totally fine. I want to see if the game is doing something extra if the bundle's data CRC doesn't match (unaffected by decompression). In UABEA, look for any asset with a recognizable name. Make sure that whatever name it is does not appear elsewhere. Next, in HxD with the unmodified, uncompressed bundle, find the string (double check there aren't multiple matches for the string) and overwrite one of the characters with anything you want (don't insert). If you do this, the CRC should change but since name fields are largely ignored, you shouldn't see any difference in-game. If the game still takes too long to load, then any kind of modification, no matter what tool, will always have this loading screen. In that case, it may be worth looking into the game's code to figure out what it's doing extra (redownloading the bundle from the internet, for example)

nesrak1 avatar Feb 16 '23 16:02 nesrak1

Bump, had this happen to me again with another android game

Swagsy avatar Jul 03 '23 19:07 Swagsy

https://github.com/SeriousCache/UABE/issues/548 There's something to it, I couldn't figure out what it is

Swagsy avatar Jul 03 '23 19:07 Swagsy

I still don't have a solution to the problem. Anyone is welcome to investigate and play around with it. I wrote something up here but no one has followed it yet to my knowledge: https://github.com/nesrak1/UABEA/issues/222#issuecomment-1433341657

nesrak1 avatar Jul 03 '23 19:07 nesrak1

Ah yeah, will test it out myself soon then, thanks!

Swagsy avatar Jul 03 '23 19:07 Swagsy

Update: In my case, this was related to the APK Signer I was using after putting everything back together after modification. After switching to another APK signer, it improved massively

Swagsy avatar Nov 19 '23 00:11 Swagsy

Update: In my case, this was related to the APK Signer I was using after putting everything back together after modification. After switching to another APK signer, it improved massively

What APK Signer do you use?

AeroForta avatar Jan 18 '24 03:01 AeroForta