1
\$\begingroup\$

I'm wondering if it is possible to obtain the filesize of a game's build at runtime.

Searching this topic only yields results for reducing the build size, which is not at all what I'm looking for.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Can you clarify what you need this for? This is a somewhat unusual thing to query, which makes me wonder if there might be a more efficient route to solving the core issue or implementing the feature you ultimately want to support. \$\endgroup\$ Commented Jan 7, 2021 at 22:33
  • \$\begingroup\$ I haven't had time to test this but you can get the size of your build directory using code from this example link. I'm not sure how helpful this will be since you need to build first and then run your build for it to work. If you want to calculate the size of a potential build in the editor, I think you will just have to guess based on all the assets in your proj \$\endgroup\$ Commented Jan 8, 2021 at 3:42
  • \$\begingroup\$ Isn't this the equivalent of asking for the (recursive) size of directory? That would depend on the OS you're developing on, not the OS you're targeting. And I'm not sure if that question is suited to this particular stack exchange. \$\endgroup\$ Commented Jan 8, 2021 at 3:43

1 Answer 1

-1
\$\begingroup\$

If you are using a Mac:

After it's built by Xcode, in the "Unity Player/build" directory there will be the app. In Finder use Get Info to see the size.

Or in Xcode, find the Products group and within that .app item and do Reveal in Finder, then Get Info.

If you want to know the size for the App Store, ZIP compress the app first.

If you are using Windows:

Right click the Unity build you have just created and right click it. Then, click properties, then general, and check the size field.

I hope this is answers your question.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Note that the question says they want to do this "at runtime" - meaning a script inside the project is running and querying the size of the game it's running in, while a player is playing the game on their device. Based on that, I don't thing a manual process done by the developer before publishing is the kind of solution they're looking for. \$\endgroup\$ Commented Jan 13, 2021 at 5:28
  • \$\begingroup\$ @DMGregory Ok, my bad. \$\endgroup\$ Commented Jan 13, 2021 at 14:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.