Easy way to check the size of unions already published to the site

I wanted to see how large the unions were combined in a lobby I was making, so I took all of the unions out of my game and pasted them into a new place:

(Unions that are the same are grouped together – those are the weird selection lines that are all over the place)

However, as I had already published that place, all of the union MeshData had been uploaded to the site – I couldn’t just file>save and check the file size. I had to store the place xml file in a script, parse through that script with the command bar:

for i,v in string.gmatch(s, [[AssetId"><url>.-</url>]]) do table.insert(t, i:sub(15, i:len()-6)) end

list all 51 assets into the script and paste them back into Notepad++

and then click each link and save the asset to my downloads. I had to click 51 links + a save button for each link, and then finally I could select all 51 files in my downloads:

and find out that the size was 2.54 MB and add that to the place file’s size (which contained PhysicsData and ChildData because AFAIK those are still saved in the file and aren’t streamed in like MeshData) to get a total size of 3.44 MB. That was an extremely roundabout method of finding out how large the unions in my lobby were.

A property/method for each union would be unnecessary, so AssetService:GetInstanceSize(instance) should be added so that we can retrieve the size of any union, decal, texture, mesh, etc without going through the roundabout method of parsing the place file ourselves and then clicking an asset link + download for the number of assets in the game. I like to make sure I keep specific sections of my games at reasonable file sizes (which I can quickly surpass if I use CSG willy-nilly) for the large number of people who are stuck on ~1/2 Mbps download speeds.

Not to be confused with UnionOperation.Size? :slight_smile:

I feel like AssetService would be an awkward place to put something like this, unless its argument was an assetId. I think the goal should be to give unions less overhead, and I’m pretty sure the server doesn’t send that much data to the client in-game (if I’m wrong then let us disable CSG physics please :shocked:).

“I feel like AssetService would be an awkward place to put something like this”

This isn’t a feature that should be restricted to unions. Image assets and mesh assets need to be downloaded as well and if you want to keep an eye on your file size then only looking at unions isn’t going to help. And a specific property for each object has been discussed on numerous threads – they are usually a bad idea because that means that you have to create a property for each of those objects. If I have a place with 1,000 unions that’s 1,000 unnecessary properties that could have been just one method in AssetService. AssetService:GetInstanceSize() is a more appropriate form of accomplishing this than UnionOperation.Size, Decal.Size, Texture.Size, SpecialMesh.Size, ImageLabel.Size, ImageButton.Size, Shirt.Size, Pants.Size, etc.

Oh, and it’d be nice to differentiate different unions. For instance, if I make this:

and later make this:

I might want to be able to tell if they’re the same union or not. I just compared them by looking inside of the file, and they’re not the same, so I ended up replacing the latter with the former (same size except vertically so I just had to resize the part above it down to make it fit) which saves the client from having to download as much. I would like to be able to do this easily for most of my unions. Perhaps something like the setting in studio that lets you display the physics owners of certain parts but instead colors the same unions (doesn’t take into account size – just compares Mesh/Physics/ChildData) similarly to make it easy to determine if two unions are similar.