Alright, so I’m trying to make destructible voxel characters that can be shot apart by bullets, and since the head alone would be 8^3 voxels, I thought UnionAsync would be appropriate, except for two things.
First is that I’m wondering why it’s an async in the first place, instead of just a regular method with no yield. I’m aware that the data is being sent from the server to a different server to be processed, and then sent back, but it’d be eons more convenient to just do it directly on the game server, or directly on the client.
The second thing is that it’d probably be acceptable if it always returned the result as fast as it does with only a couple parts, but it gets throttled and takes 1 to 4 seconds nearing the maximum number of parts, which is of course devastating when I’m trying to break the characters apart in real time.
And since I know someone is going to bring this up, I’m aware that this isn’t at all what the async is intended to be used for. I’m more of advocating that it be given a broader function.
It’s probably intended to offset the union processing off to a separate CPU thread so it doesn’t block the game’s main thread. It’s fairly intensive, especially with more complex collections of parts.
I’d have thought it’d have been rather fast and didn’t realize that was the drawback. This is kind of going off into the weeds, but would letting us implicitly construct our own procedural meshes be on the table? I assume it’d be relatively easy to implement since we’d basically just be passing vertices, triangles, and UVs into some factory method that I’m sure already exists…
Create it as a feature request if you’re requesting that unions can be created faster and more locally. Your question of why it’s async has been answered already so I’d mark Terrodactyl’s answer as the solution and create a separate feature request.
The reason I believe it takes time to create the union is that they are similar to mesh in that they are asset-like and can be preloaded.