My entire game, has 6000 parts. I just used:
game:GetDescendants()
It said around 6000, and I want to know 2 questions:
Does a union of 5 parts count as 5 parts, or 1 part?
On an average computer, will 6000 parts lag an average windows 10 (One of the most popular computers out there, average.)
It might. To mostly stop the lag, you can buy a high-tech supercomputer that runs windows 10 with the highest screen-resolution possible.
Or, instead of making games for the few supercomputer users out there, you could use StreamingEnabled.
StreamingEnabled is a special utility that will load parts of your game when needed. Read more about it here.
I’ve tried it and it worked! It reduced some of the lag but, there may be some Cons.
Unions mess up the hitbox so if you walk on it would look like you are floating in mid-air. If you are unioning 6000 parts or more it would take a long time even if you are doing it one by one. Also, Unions can sometimes corrupt very easily, if it corrupts the asset will be hard to restore back.
So, there is something that you can do, so collisions are precise. You can do this and the union will be precise with where you fall in, what is solid and what is not.
The main issue, in my opinion is that it sounds like you’re relying on Unions for the bulk of your parts, which aren’t nearly as efficient objects as MeshParts. I would strongly recommend learning how to 3D model and upload meshes that you’d have a lot more control over in its memory usage (reducing poly counts and so forth) and other fine-tuning optimizations.
I was hesitant to have to learn how to make meshes since I was also pretty used to Unions, but it has reduced lag a hundredfold.
One glitch, I use blender, and when I import my file, from blender, it freezes for about 5 seconds, and the meshpart never gets the mesh I wanted it to…
A glitch or am I doing something wrong?
Should I put a mesh in a part and try it or?
I’m not really sure what could’ve gone wrong, this isn’t a lot of detail to troubleshoot with. All I can say is that make sure you’re importing .OBJ or .FBX files and not .blend files themselves.
I have tried this and an easy way to do this is export the union and then import it which makes it a mesh part. It reduced lag in my case.
To fix this just set CollisionFidelity to PreciseConvexDecomposition.
To answer this specifically, a union would count as way more than however many parts were unioned together. Parts are instanced very well, meshparts are instanced quite decently, but unions are on a whole different scale.
When you create a union, Roblox is already storing data as to which parts were unionized, this is so you can revert the process (converting unions back to parts). Already by creating a union, you’re using up a very small amount of server memory. This can add up.
Also when creating a union, it’s no longer a simple basepart or meshpart that’s saved on the website. It has its own geometry. This makes unions typically harder on the server to calculate.
In my opinion, unions are terrible and using GetDescendants() on a bunch of unions is worse than using it on a bunch of parts or meshparts. Especially if you’re then getting all those descendants and configuring them.
So, if I make a world, with nothing in it, and make a union of 5 parts, will GetDescendants say 1 or 5?
My mistake, I originally thought you were asking about memory/performance, hence your topic title. But to answer this, it would say one.