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

BuildLayout Explorer displays "Unknown" size #1

Open
pschraut opened this issue Aug 31, 2021 · 1 comment
Open

BuildLayout Explorer displays "Unknown" size #1

pschraut opened this issue Aug 31, 2021 · 1 comment

Comments

@pschraut
Copy link
Owner

The "size" column sometimes displays "Unknown", rather than the actual size.

Some regions don't use the period symbol . as decimal separator, but a comma ,. The generated buildlayout.txt file uses comma as string delimiter, but the size uses a comma as decimal separator too in some regions/locales. BuildLayout Explorer is unable to properly parse it in this case.

Archive localization-assets-shared_assets_all_5f730b3baa8e25759a6eaa66cd80e6fb.bundle (Size: 21,9KB, Compression: Lz4HC, Asset Bundle Object Size: 1,14KB)
	Bundle Dependencies: defaultlocalgroup_monoscripts_27491efc4f8c5cd1c6bed6b18f652f2b.bundle
	Expanded Bundle Dependencies: 
	Explicit Assets
		Assets/localization/texts_shared_data.asset (Total Size: 13,91KB, Size from Objects: 13,91KB, Size from Streamed Data: 0B, File Index: 0, Addressable Name: texts_shared_data)

The problem is this text (Size: 21,9KB, Compression: Lz4HC for example. 21,9KB uses a comma and that's why parsing this comma-delimited string list fails.

I'm aware that the German locale uses a comma as decimal separator and thus displays "Unknown". I don't know about other locales. English does work.

image

@zsoi
Copy link
Contributor

zsoi commented Mar 8, 2022

Can be easily fixed in a custom branch of addressables by modifying BuildLayoutPrinter.cs:

Index: BuildLayoutPrinter.cs
===================================================================
--- BuildLayoutPrinter.cs    (revision 30946)
+++ BuildLayoutPrinter.cs    (revision 30947)
@@ -1,6 +1,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using UnityEngine;
@@ -23,7 +24,7 @@
 
             double byteSizeFloat = (double)byteSize + (double)prevOrderRemainder / 1024;
 
-            string result = String.Format("{0:0.##}{1}", byteSizeFloat, sizes[order]);
+            string result = String.Format(CultureInfo.InvariantCulture, "{0:0.##}{1}", byteSizeFloat, sizes[order]);
             return result;
         }

Also the build layout parser of the explorer needs to be modified to always parse floats in the invariant culture, as otherwise an editor running with german locale will spit out wrong numbers as well (e.g. 18.28kb parses as 1828kb).

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