# Still a problem with acessing a child actor component's variables

**URL:** <https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [May 1, 2015, 4:12pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966 "2015-05-01T16:12:26Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![KVogler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KVogler](https://forums.unrealengine.com/u/KVogler)\
**Post date:** [May 1, 2015, 4:12pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/1 "2015-05-01T16:12:26Z")

</div>

Hi,

I am busy making some blueprints, but I still cant figure out how to access child component variables.  
A simmilar problem (still unsolved) is described in this post here: [https://forums.unrealengine.com/showthread.php?66359-How-to-access-child-components&highlight=access+child+actor+component](https://forums.unrealengine.com/showthread.php?66359-How-to-access-child-components&highlight=access+child+actor+component)

Now I have a simmilar situation and just cant figure out how to do it. :o

Lets say we have a blueprint with some public/editable variables like this one:

It has an integer called “FloorCount”, an enumerator for the column type and an actor variable, called “Datasource”

 ![Child01.JPG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/2/5/25a25d7aaa90c22cfa6219b3ed1dcc28e49f55b1.jpeg)

In the construction script, the BP reads from the Datasource and creates the fassade column as defined there.  
The “FassadeTable” basically just holds the column description data.  
That works out really good so far.

Now I want to make a Blueprint that creates a row of those columns.  
It also has a variable to the “FassadeTable” datasource and a integer variable for the number of columns to create.

![63392010f0b3c1eeda033425c4f15cc09c692fbb.jpeg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

As you can see, the child components are properly spawned, but the column are not there.  
That is because the child component’s “Datasource” field is still empty…

This is how the construction script for the FassadeRow Blueprint looks like:

![ec16ceb86df9cf006043327673ee91cc50938972.jpeg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

So now after I created the child actor component (of class type “FassadeColumn”), I cant figure out how to set its “Datasource” and “FloorCount” values…

If I pull out from the created actor output node, the menu doesnt offer me much:

 ![RowConst02.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/c/0cd20a38539b2e0bfefe869fc4b98cc5c27dffd9.jpeg)

When I disable the context sensitivity, I can choose between two “Datasource” elements.

![b5ad4540936b9d48bfb3063746bc03ed04f6bb08.jpeg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

The “default” one is the one of my TableRow script, so lets try the other one…

 ![RowConst04.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/e/8eb039fb7ce3f04aad4af6232ad8c872dc235898.jpeg)

Nope, doesnt work. Neither does it work for the FloorCount…☹

 ![RowConst05.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/2/2/2222a7555495bc1f38650e2a5209eb62da430475.jpeg)

Soo. What am I doing wrong. How can I set the FloorCount, Columntype and Datasource for the child actors 😕

Thanks for any help 🙂

Cheers,  
Klaus

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [May 3, 2015, 3:00am UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/2 "2015-05-03T03:00:51Z")

</div>

Hello,  
Your “return value” is a child actor component not your blueprint type. I haven’t try but i suppose that with a “cast to” your blueprint (with context sensitive uncheck) you would acces your variables.

---

<div class="post-metadata">

**Author:** ![Falconsoft](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Falconsoft](https://forums.unrealengine.com/u/Falconsoft)\
**Post date:** [May 3, 2015, 4:46am UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/3 "2015-05-03T04:46:33Z")

</div>

well if it is one thing i have learned from many years of many similar programs(programs which will remain nameless) it is that you can use global variables to your advantage.

---

<div class="post-metadata">

**Author:** ![KVogler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KVogler](https://forums.unrealengine.com/u/KVogler)\
**Post date:** [May 3, 2015, 5:30pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/4 "2015-05-03T17:30:34Z")

</div>

Thanks for your replies 🙂

> [@](#):
>
> Your “return value” is a child actor component not your blueprint type. I haven’t try but i suppose that with a “cast to” your blueprint (with context sensitive uncheck) you would acces your variables.

I thought the type is already set for the return value, since I picked the class in the details panel of the node. Thats why it says in the node “Actor Class Fassade Column”.  
When I do a cast, it fails:

 ![Cast01.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/3/c/3c38608b280af3a8a8454d8319e2ca078960726c.jpeg)

So Im still not able to access the component’s variables ☹

> [@](#):
>
> well if it is one thing i have learned from many years of many similar programs(programs which will remain nameless) it is that you can use global variables to your advantage.

What do you mean by “global” in this case? The level script?  
I want to make this as self contained as possible. When I write code, I (almost) never use global variables.  
Th Blueprints should be usable in any level without making changes to the level script.  
The separation of the data and the blueprints with actors also serves anotehr purpose. By linking up a diferent FassadeTable instance to th Datasource property of the TableRow/Column you can easliy set up a different look, etc…

So any help is still welcome 🙂

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [May 3, 2015, 5:46pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/5 "2015-05-03T17:46:51Z")

</div>

I just kept time to do tries and finally found : from return value : “get child actor” and from it “cast to” (I suppose because this is a component and you need the actor itself to have the “cast to” to work.)

---

<div class="post-metadata">

**Author:** ![KVogler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KVogler](https://forums.unrealengine.com/u/KVogler)\
**Post date:** [May 3, 2015, 8:01pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/6 "2015-05-03T20:01:51Z")

</div>

> [@](#):
>
> I just kept time to do tries and finally found : from return value : “get child actor” and from it “cast to” (I suppose because this is a component and you need the actor itself to have the “cast to” to work.)

Thanks for testing 🙂  
I tried it with the following results:

 ![Cast02.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/2/3/23dad74f5318673a7889a4337544c070a9728f69.jpeg)

If I choose the FassadeColumn Set Datasource node, it connects and the cast works…  
(The Datasource getßnode is from the Datasource variable of this FassadeRow BP)

![fe12763df0c9eea3624469ae569537ea3714a303.jpeg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

But in the Editor, the columns are still invisible. So somehow the assignment doesnt seem to work… ☹

![fb059a774220433471c34e80621761fb95e535b9.jpeg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

Is there still a hidden catch that I may have missed? 😕

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [May 3, 2015, 8:24pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/7 "2015-05-03T20:24:58Z")

</div>

Have you check your “datasource” variable reference value and be sure that it is filled with needed values when you set it ? You may try to set it on spawn / begin play in event graph instead of construction script to see if there is a difference.

---

<div class="post-metadata">

**Author:** ![KVogler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KVogler](https://forums.unrealengine.com/u/KVogler)\
**Post date:** [May 3, 2015, 9:29pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/8 "2015-05-03T21:29:26Z")

</div>

The datasource of the FassadeRow BP instance does hold a reference to the FassadeTable BP.  
The FassadeTable holds the correct data. All the single FassadeColumn BPs that you see in the background are also reading from it.

The **FassadeRow** assignment:

 ![Editor2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/2/c/2c095865a4b96a023598d74c844e3a9323fb8744.jpeg)

Just as the **FassadeColumn** instances (which read the data correctly) :

 ![Editor3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/3/7/3731b68ab5632f39e0fc1bab1f07ab4cfa595a20.jpeg)

And the **FassadeTable** instance in the level:  
 ![1c6f3a3dd783e0616deafed83a07bf163729557a.jpeg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

If anything would be wrong with the datatable, then the single columns would not build correctly (which they do).  
Setting the value of the child component should trigger its construction script, right?

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [May 3, 2015, 11:12pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/9 "2015-05-03T23:12:43Z")

</div>

I maybe totally wrong but what i wonder is if the variable reference “datasource” from fassade row BP used here to set “datasource” from “cast to fassade column” has been set.  
If i had to debug it for me, i would try a print string of values in this reference to check if it is ok or not or at least check and set manually variable in blueprint.  
Then, if variable seems ok, i would try to set “datasource” in event graph instead of construction script.

---

<div class="post-metadata">

**Author:** ![KVogler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KVogler](https://forums.unrealengine.com/u/KVogler)\
**Post date:** [May 3, 2015, 11:24pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/10 "2015-05-03T23:24:24Z")

</div>

> [@](#):
>
> If i had to debug it for me,

Up until now I havent looked into the BP debugging options.  
Tomorrow I will check and see if I can trace the values through execution…

> [@](#):
>
> I maybe totally wrong but what i wonder is if the variable reference “datasource” from fassade row BP used here to set “datasource” from “cast to fassade column” has been set.

Well, I set it in the details, just as for the single coumns (see screenshots). The instance of the FassadeTable BP in the level is also called “FassadeTable”…

> [@](#):
>
> i would try to set “datasource” in event graph instead of construction script.

How is that done? How do I get a reference to the FassadeTable instance?

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [May 4, 2015, 5:58am UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/11 "2015-05-04T05:58:32Z")

</div>

To try to set datasource in event graph, create a variable of your child actor when you add it and use it in event graph to drag your “set datasource”

If you have check that both your variables are right set (with a key event print string " with datasource" values from variable and from childactor “datasource” in event graph) then is your actor component transform ok ? (i would try with a simple basic mesh in blueprint to confirm or a print string of a get transform / break get location / get scale in case of for some reason there is a modification) if location is wrong, it may be ok but in the wrong location.  
If transform is ok then “add child actor component” is ok, “cast to” is ok, “get datasource” is ok, “set datasource” is ok. I would check the use of datasource in child actor blueprint.

---

<div class="post-metadata">

**Author:** ![KVogler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KVogler](https://forums.unrealengine.com/u/KVogler)\
**Post date:** [May 11, 2015, 5:04pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/12 "2015-05-11T17:04:27Z")

</div>

@Fen  
Thanks for the suggestions. 🙂

I have now tried different approaches to see if the dtatsoirce reference in the FassadeRow script hold the correct data. i does.  
When I create floor meshes directly in the FassadeRow BP, it works beautifully.

So, FassadeColumn BP work correctly if datasource is set.  
FassadeRow datasource also works correctly. the Row could create individual floors from that.  
Just the FassadeRow.Datasource to FassadeColumn.Datasource reference pasing wont…☹

So Im pretty stuck with thisone 😕

---

<div class="post-metadata">

**Author:** ![Kartom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kartom](https://forums.unrealengine.com/u/Kartom)\
**Post date:** [April 18, 2016, 8:19pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/13 "2016-04-18T20:19:55Z")

</div>

I know this is an old thread, but i was curios if you ever found out how to do this?  
I have been looking for a solution to this a while now, but I havent found one, neither in BP or C ++  
Using actors (blueprints) inside of actors (blueprints) and giving parameters to the inner actor at construction time seams to be a thing that definitly should work!  
Your example makes perfectly sense to me, and i can think about a lot of other cases when this should be useful.

Yes, you can set the parameters if you spawn the inner actor, but that would have some drawbacks:

- The inner actor will not be visible in the editor
- The inner actor can’t be placed visually

Can someone (from Epic?) confirm that this is not possible in UE4?

---

<div class="post-metadata">

**Author:** ![chuckleplant](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@chuckleplant](https://forums.unrealengine.com/u/chuckleplant)\
**Post date:** [November 19, 2016, 3:48pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/14 "2016-11-19T15:48:59Z")

</div>

Bumping because this is still an issue for me. No resolution whatsoever, weird that this isn’t more common.

---

<div class="post-metadata">

**Author:** ![GeeksGoneBad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GeeksGoneBad](https://forums.unrealengine.com/u/GeeksGoneBad)\
**Post date:** [December 13, 2016, 2:25pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/15 "2016-12-13T14:25:09Z")

</div>

I am running into this too - I am making a modular office set up and in my actor I have a child actor that has “number of drawer” options (a file cabinet) and in the BP editor I can set the number of drawers on the child actor - no problem - works great… but when I expose a variable for “File Cabinet Drawers” - and then in the set up of the File Cabinet - get the child actor - cast to file cabinet - set the number of drawers - I can SEE the execution happening as I want it to - but the file cabinet does not change

 ![Screenshot 2016-12-13 09.23.30.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/e/f/effd243ff8807f96c1866288ac2d076e0ba11721.png)

---

<div class="post-metadata">

**Author:** ![Blakeanator](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/blakeanator/32/626459_2.png) [@Blakeanator](https://forums.unrealengine.com/u/Blakeanator)\
**Post date:** [June 18, 2017, 8:30am UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/16 "2017-06-18T08:30:50Z")

</div>

Still seeing this problem here. Ejecting into the Editor while running the game and selecting the Child Actor immediately causes it to deselect itself. Almost like the object’s memory was released. Or maybe that’s just how it behaves since it’s now a component of the parent actor. Regardless, there is no clear instruction on how to properly use it IMO.

---

<div class="post-metadata">

**Author:** ![BlueIshDan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlueIshDan](https://forums.unrealengine.com/u/BlueIshDan)\
**Post date:** [March 25, 2020, 2:26pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/17 "2020-03-25T14:26:04Z")

</div>

Figured it out on my end:

Get Child Actor from Actor Component

Cast Child Actor to Actor Class

Wrap a function around what you do with the updated value.  
Create an event for setting that value, then call the function.

Call new event from Casted Actor and pass value.

Should work from there 🙂 Lemme know.

---

<div class="post-metadata">

**Author:** ![IsThisAMug](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IsThisAMug](https://forums.unrealengine.com/u/IsThisAMug)\
**Post date:** [October 21, 2024, 6:53pm UTC](https://forums.unrealengine.com/t/still-a-problem-with-acessing-a-child-actor-components-variables/28966/18 "2024-10-21T18:53:12Z")

</div>

Just so its clear, conceptually, for anyone stumbling down here.  
If you drop a blueprint into another blueprint it becomes a child actor. If you want to retrieve the actual actor for interacting with its data then plug a ref to that child actor into the node: “Get Child Actor” . It returns an AActor from the child actor in the blueprint. That AActor is what you cast to its respective class.
