Skip to content

Build Size Optimization: moved unused files outside from Resources folder, sprites' scale fixed to support compression #130

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

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

umutkutlu
Copy link
Contributor

These files from WalletConnectUnity and MetaMask plugins are included into the builds even if they are not used because they are under Resources folder. For more info about the Resources folder.
This pull request moves these files to their parent folder.

5.4 mb 4.9% Assets/Thirdweb/Plugins/WalletConnectUnity/Resources/Animated Loading Icons/Spritesheet/Icons Spritesheet.png
1.9 mb 1.7% Assets/Thirdweb/Plugins/WalletConnectUnity/Resources/eip155_1.png
1.3 mb 1.2% Assets/Thirdweb/Plugins/WalletConnectUnity/Resources/walletconnect-banner.e1cb8d21.png
1.3 mb 1.2% Assets/Thirdweb/Plugins/MetaMask/Resources/MetaMask/EditorImages/MetaMask_EditorWindow_BG.psd
341.5 kb 0.3% Assets/Thirdweb/Plugins/MetaMask/Resources/MetaMask/EditorImages/MetaMask_Button.psd
341.5 kb 0.3% Assets/Thirdweb/Plugins/MetaMask/Resources/MetaMask/EditorImages/Metamask_Stacked_Logo.png
170.8 kb 0.2% Assets/Thirdweb/Plugins/MetaMask/Resources/MetaMask/EditorImages/MetaMask_Header_Logo.png
109.4 kb 0.1% Assets/Thirdweb/Plugins/MetaMask/Resources/MetaMask/Sprites/metamask-logo.png
85.5 kb 0.1% Assets/Thirdweb/Plugins/MetaMask/Resources/MetaMask/EditorImages/Metamask_Logo.png

Total size: ~10.94 mb

@umutkutlu
Copy link
Contributor Author

Also, only textures with a width and height that are multiples of 4 can be compressed to DXT5/BC3 format in Unity. Therefore, I fixed the sprites' scales to support compression as well.

While the size of the source asset files increases (~50kb), the build size of the game textures decreases significantly (~1.3 MB). For example:

Panel_Connect.png: 1.0 MB => 254 KB
Panel_Connected.png: 489.5 KB => 122.4 KB
Logo_SmartWallet.png: 122.4 KB => 30.2 KB
Outline_Network.png: 51 KB => 13 KB
Button_Black.png: 50.8 KB => 12.5 KB
Button_White.png: 32.2 KB => 8.4 KB

@umutkutlu umutkutlu changed the title Build Size Optimization: moved unused files outside from Resources folder Build Size Optimization: moved unused files outside from Resources folder, sprites' scale fixed to support compression Nov 22, 2023
@0xFirekeeper
Copy link
Member

Hey thanks for this! I'll review and make sure nothing breaks

At first glance I think these are safe to remove:

  • 5.4 mb 4.9% Assets/Thirdweb/Plugins/WalletConnectUnity/Resources/Animated Loading Icons/Spritesheet/Icons Spritesheet.png
  • 1.9 mb 1.7% Assets/Thirdweb/Plugins/WalletConnectUnity/Resources/eip155_1.png
  • 1.3 mb 1.2% Assets/Thirdweb/Plugins/WalletConnectUnity/Resources/walletconnect-banner.e1cb8d21.png
  • 1.3 mb 1.2% Assets/Thirdweb/Plugins/MetaMask/Resources/MetaMask/EditorImages/MetaMask_EditorWindow_BG.psd

The sprites scale changes on the other hand are great, thanks a lot!

@0xFirekeeper
Copy link
Member

Okay this looks good to me thanks Umut!

@0xFirekeeper 0xFirekeeper merged commit 2b81a3d into thirdweb-dev:main Nov 22, 2023
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

Successfully merging this pull request may close these issues.

2 participants