Announcement

Collapse
No announcement yet.

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

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

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

    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/show...ctor+component

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

    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"

    Click image for larger version

Name:	Child01.JPG
Views:	1
Size:	116.9 KB
ID:	1149115

    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.

    Click image for larger version

Name:	Row01.JPG
Views:	1
Size:	106.7 KB
ID:	1149116

    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:

    Click image for larger version

Name:	RowConst01.JPG
Views:	1
Size:	61.9 KB
ID:	1149117

    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:

    Click image for larger version

Name:	RowConst02.jpg
Views:	1
Size:	126.5 KB
ID:	1149118

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

    Click image for larger version

Name:	RowConst03.jpg
Views:	1
Size:	100.9 KB
ID:	1149119

    The "default" one is the one of my TableRow script, so lets try the other one..

    Click image for larger version

Name:	RowConst04.jpg
Views:	1
Size:	64.1 KB
ID:	1149120

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

    Click image for larger version

Name:	RowConst05.jpg
Views:	1
Size:	78.6 KB
ID:	1149121

    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

    #2
    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.

    Comment


      #3
      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.

      Comment


        #4
        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:

        Click image for larger version

Name:	Cast01.jpg
Views:	1
Size:	92.3 KB
ID:	1075601

        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

        Comment


          #5
          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.)

          Comment


            #6
            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:

            Click image for larger version

Name:	Cast02.jpg
Views:	1
Size:	77.1 KB
ID:	1075608

            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)

            Click image for larger version

Name:	Cast03.jpg
Views:	1
Size:	71.5 KB
ID:	1075609

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

            Click image for larger version

Name:	Editor1.jpg
Views:	1
Size:	96.9 KB
ID:	1075610

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

            Comment


              #7
              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.

              Comment


                #8
                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:
                Click image for larger version

Name:	Editor2.jpg
Views:	1
Size:	370.8 KB
ID:	1075613

                Just as the FassadeColumn instances (which read the data correctly) :
                Click image for larger version

Name:	Editor3.jpg
Views:	1
Size:	413.1 KB
ID:	1075614

                And the FassadeTable instance in the level:
                Click image for larger version

Name:	Editor4.jpg
Views:	1
Size:	208.5 KB
ID:	1075615

                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?

                Comment


                  #9
                  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.

                  Comment


                    #10
                    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?

                    Comment


                      #11
                      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.

                      Comment


                        #12
                        @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

                        Comment


                          #13
                          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?

                          Comment


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

                            Comment


                              #15
                              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

                              Click image for larger version

Name:	Screenshot 2016-12-13 09.23.30.png
Views:	1
Size:	350.6 KB
ID:	1120029
                              Every day I beat my own previous record for the number of days I've stayed alive!

                              Comment

                              Working...
                              X