I think that you can’t take apart unions using in-game scripts. This means that you will have to store/serialize the properties of the parts you want to create a union of, just before making the union. Then based on their properties recreate them, and recreate the union using UnionAsync in your in-game code.
Keep in mind when it comes to serialization you don’t have to store all the properties of those parts, you should start by asking yourself “how many properties do I actually need to correctly recreate the union?”
Ouch… well okay, I’ll have to rethink a lot of things then. I still want the player to create custom shapes though…
Say a player wants to make a bowl, they can use two spheres, a cylinder, and a block to make one. So I guess every time a union is created, MainPart and OtherParts need to be put in folders whos parent is the union?
So like this:
union >
MainPartFolder >
part
OtherPartsFolder >
part
part
part
Correct?
Oh, and all of these parts should have their collisions turned off and transparency set to 1. I’m apprehensive about doing this in the workspace, as it could cause a lot of lag, but I don’t know where else to do this, as I have hundreds of parts named the same thing, and it would be a mess moving everything around.
Depends on your implementation. All you need to do is implement a way to store the information of the parts prior unioning them, because the process isn’t reversible. That’s also useful in case you want to allow the players to edit the union afterwards.
Basically you don’t need to have the parts in the workspace 24/7, you just need to have their information, somewhere. The only scenario where you actually need them in the workspace is while the user is editing the union(not just viewing it). You don’t need to render parts in order to have their info. For example you can store the info as a serialized string, or have parts in server storage, etc.