Transfer components with a array or a list for create a interior loading

Hi, I’m trying to relocate child components from one actor to another.

Basically, I created an array that stores all the components that are children of an actor, and now I want to unpack it into another similar actor.

I already have everything referenced, I just need to know if there is a proper node for this. I don’t specifically want the component class. I know you can take a class and recreate it with the same values, but considering that I can only store them in an array, I believe I can extract them with their saved values.

The type of the array is an actor component. With this, I can store all child components derived from the actor component.

For example: I have a vase that is a static mesh, as well as a flower that is a skeletal mesh. (Both can be stored within the array, as their only limitation is that they are actor components). until then ok. What I need is to relocate them somewhere else. In this case the flower and the vase are in the store, and they need to appear in the garden. This is an analogy, what I want is much more complex and would not depend on just respawning an actor of the same class.

As you can see, this is part of the real case.

I’m trying to create a controlled load of a structure, where elements are relocated in a controlled way.

In this case, I stored a collision box and a static mesh within the same array. I could recreate them manually within each actor, but that would require multiple transfer variables and there would be infinite possibilities for each structure, which would result in something inefficient in this case.

You can duplicate an object, but only in C++. As far as I know, Blueprint does not have such a function.

1 Like

I imagine it is possible to do the same somehow. The problem is that it will be much more extensive.

The first way given to me by the nodes is to check the class and recreate it through the class repeatedly and for a number of times similar to the size of the array, but values ​​such as transformation would probably be lost

This is certainly possible. You just need to get the values ​​of all the variables and set them to the new object.
The problem is more work if the class is large.
In addition, for each new class, you will need to re-create a new duplication function, since the other class already has different variables (you can make your life easier by using interfaces)

If there are not very many of them, then you can do this manually.

In C++ this is already automated, since there you can get all the variables in the form of an array and simply use a loop.
This is essentially what happens during duplication.

1 Like

That was precisely the intention. Unfortunately, since I apparently don’t have a node to relocate actor components, using a loop to perform the task is currently blocked.

I think I will need to create a check for each element in the list. Honestly, this is a problem, as I would have to put several casts into action.

In fact, if anyone knows a native way to activate the elements within the actor in a controlled way, I would greatly appreciate it. because the main reason for this is that I don’t want the actor to be brought on stage all at once. (Note): I could use logic in bp for each type of construction, but this would delay development, in addition to being very repeated logic.

If I did that, the size of the thread would be completely different for each of the actors. The array loop would be perfect for this reason. He would check the size himself and take care of sending the components

If the move suits you (without creating a copy), attach component to component will suit you.
In conjunction with get components by class, this will work automatically.

I’m trying this at the moment. Basically I have 3 actors and a component actor

The first actor is the generated structure, the second is an empty actor with a black box to represent the actor, the third is an empty actor, which is gradually filled with the elements of the first.

Basically the first is just for visualization, the second is for optimization and the third is executed when the player enters the collision box.

The component does all the execution of storing the components in an array and sending it to the last receiver.

Within the component, there are 4 Casts:

However, the actor is not appearing on the scene yet.