I am trying to develop a tool to help me doing certain tasks for my dev. Here, I have already created a function used to convert a dynamic mesh component into a static mesh.
Now I am trying to extend it with a new function to convert a group of dynamic meshes into a static mesh. I think my problem is with my loop because when I am executing it, I get too many iterations of what I am copying :
You are here trying to access something from inside the loop. This can only be done if you are still inside of it, but the Copy Mesh to Static Mesh is placed after the loop has been completed, which means you need another way of doing it:
Here I tried to merge those 2 dynamic meshes block into one static mesh, but I get 3 iterations of it plus a single one alone in the same static mesh, where I only want to get a single copy of those two blocks.
As @XxpiingyxX pointed out, your second loop is a mess. (it’s also not needed but that’s beside the point) I hope you’ve fixed that.
What sticks out to me is that you are always adding to that mesh. DMCs Fusion is a local variable so its created empty on every call but the dynamic mesh component… Where do you clean that out.
Also, since you are going for the loops, print some kind of a debug string to see how many iteration you are going through. It might be the case that you’ve selected more things than you think.
Hey, I see your purpose, but I dont get how to do it without loop.
I created the first loop to get all the selected assets from viewport and the second to take all that assets and append them to a single one to then create a static mesh.
But if there is another proper and easier way to do this, dont hesitate to demonstrate it .
Also, why do I need to “clear” my dynamic mesh component, what is the point to do this ?
I tried your solution and I have to say it is way better than using 2 loops. I didnt know about those nodes !
By the way, I still have my duplication problem but I know from where it comes… beacause I call this function directly by clicking on it after selectionning many dynamic meshes, the function call itself as many times as I have selected DMCs… Thats why I always end up with too many iterations xD