Attach blueprint to component?

Hi everyone,


I have 2 blueprint :

Blueprint “A” = the MAIN blueprint with a “public blueprint variable” and “a component”

Blueprint “B” = the blueprint that i want to attach to the component (in blueprint A) using the “public blueprint variable”

(no socket, no skeletal, don’t put actor blueprint_B in scene to use “attach actor to component”)

https://dl.dropboxusercontent.com/u/21672921/_FORUM/attach_blueprint_to_component.jpg


Thanks for your help !

As long as BP B is a subclass of Actor, then it’s easy. Call node “Spawn Actor Blueprint B” and then pass the result of that into “Attach Actor To Component” as the target. For In Parent argument, you can pass in your static mesh you just created. You can leave the socket empty if you don’t have one to use here. I would pick “Keep relative offset” for the Attach Location Type at first.

Thank you @Furroy, it is nice to have a response !
Yes i know this method to attach an “actor to a component”, but it’s necessary to spawn the actor in the scene before attaching.
Like you can see in my previous picture, I work directly in the “Construction Script” to be apt to see dynamically the changes when i modify different public variable in my main blueprint (A).

Maybe you need more information to understand the extent of my problem (I tried to make my request as generic as possible, but maybe it will be easier with all the details!) :


Blueprint_A is my solar system, it simulate movement using only components which are created dynamically with public variables. User can choose one or more planets. Dynamically, all new public variables are created to set the rotation and revolution time of each planet directly in the scene via the details panel and to select which “blueprint planet” he want to put inside the component.

Blueprint_B is one of these planets.

I would like to be able to put my Blueprint_B (planet) inside the details panel of the Blueprint_A (solar system with only components).

In fact all my interactions are created and my solar system just want a beautiful blueprint in each of its components which are currently empty !!


https://dl.dropboxusercontent.com/u/21672921/_FORUM/attach_blueprint_to_component2.jpg

Is it possible to attach a blueprint to component ?

Thanks

ok, so on the solar system blueprint you add a variable called planets. make sure it’s not private, set to editable, give it a tooltip like “an array of my planets”, change the type to blueprint_planet, and then click the button next to that to turn it into an array of planets. I would put it in a new “planets” category as well.

drop a copy of this solar system in your map. drop a copy of the planet blueprint for each planet into the map. select each of the planets and edit their properties. select the solar system and check out it’s new planet property, from there you can click on the + button to add an element for each planet, and then select which order you want the planets added.

in your solar system’s begin play event, you can then loop over this array of planets and do whatever it is you need done, reattach them as children of the solar system or whatever.

good luck!

Thank you@Furroy,

I did not think to use my blueprint as actor to attach actor to component after put blueprint in the scene !! It’s a really good idea =)

I think this work but it seems that my component is stuck and don’t want to be animated =(
Do you know why ?


So now to resume my problem :

Each planet (Blueprint_B) is add to my Blueprint_A (solar system) in an array (variable type = “actor”; name = “planets_place_in_the_scene”).

In my Blueprint_A Constructor script, I want create and attach dummy (component) to each planet actor.

In the Blueprint_A Event Graph, I want animate all my dummies.

https://dl.dropboxusercontent.com/u/21672921/_FORUM/attach_blueprint_to_component3.jpg


Thanks