I am trying to make a blueprint for placing building’s structural elements.
And I feel nice if variables (i.e. count, offset, etc.) could be held by child actor component.
Thus, I need the way to access to the value set with detail panel in construction script.
After testing it for a while, I noticed that child component’s variable indicates “0” in construction script.
(I expect to get the value set by blueprint detail panel or level editor detail panel)
Incidentally, the variable seems to be correctly initialized before “BeginPlay” function because I can access to expected value in it.
I tested with both blueprint and C++ (screenshots are taken with C++ one), and I got same result.
I will fully appreciate it If someone has solution with this problem and lets me know. Thank you.
(In the imagine, make the variable be initialized before construction, or get detail panel’s value directly?)
The reason is that i want to duplicate static meshes on construction and let them visible in level editor even if the game is not played.
And from my understanding, it needs to be executed at the time of construction.
Besides, the reason why I intend to define variable in child component is multiple inheritance.
I am searching the way of integrating several functions (at this time, array and mirror) smartly.
Anyway, I recognized clearly why that happened by the document that you introduced to me.
Also, I understood that it is designated relationship between actor and component with the intention.
Perhaps, proper way is to define all variables in parent actor, isn’t it?
If I have misunderstood what you are trying to do, then please forgive me from the start. This is what I think you are attempting to do.
You have multiple blueprints, and you wish to obtain values from those blueprints during the construction phase of one of the blueprints.
You will be able to get those values, that’s not a problem, but, the point is, until you force those other blueprints, to actually run their own construction, it’s always going to be either the default value, or the last value that you set them too, via the details panel of the editor. The editor is only going to run one construction at a time, and that will be for the blueprint, that you just changed values for, or dragged around in the level, etc. Only during “gametime” (i.e. when Begin Play is called), will all the construction scripts be invoked by the engine.
Does this mean you cannot do what you want? Nope, it means that in the Blueprint, that you wish to get the data for, that it should Determine if it’s running in the level editor, or at game time. This is easy, if “Begin Play” has not been called, then it’s in the editor. If it’s in the editor, then invoke the construction script of the blueprints, that you wish to have the data from. The easiest way to invoke the construction script for me anyway, is to put really nothing in the construction scipt, but a call to a function, which does all the work, this allows the “construction” script to be called from the Begin Play event (or any other place that I wish it to happen) as well, along with the Construction script, being able to be invoked from and external blueprint as well.
Thank you for your answer. There is nothing to forgive.
The easiest way to invoke the construction script for me anyway, is to put really nothing in the construction script, but a call to a function, which does all the work, …
What I want to put in such function is that child component gets values from (level / blueprint) editor’s detail panel, then overwrites its member variables.
I think this is executed outside of user code.
If I can write it explicitly, it will become a solution.
I’m sorry about my vague description, if it occurs.
I mean “level editor” which is set the value to instance of blueprint, and “blueprint editor” which is set value to default of blueprint.
I am inheriting familiar “Actor” blueprint, and “ActorComponent” for child.
My primary goal is setting value via level editor with selecting that blueprint’s child component.
Ok, I think i’m following, although I"m not sure, why the “Actor” blueprint needs a “ActorComponent” child. The reason I say this, is that the Actor can create as many components as it wishes, Keeping them in arrays etc, and you can expose any variables you wish, for the details panel in the level editor. Such that you can still have the defaults for the blueprint itself, but each “instance” of the blueprint in the level, and have it’s own settings two, and in this fashion, not have a requirement for 2 different blueprints. The actorcomponents will be created behind the scenes, by UE4, as you create the components.
But if you still wish to use the two seperate blueprints, then all you need to do is use the node “Get all Actors of class”, where the class is set to the blueprint of your “child” components. Then interrogate the child in some fashion by calling a function to let you know, which child you are talking too. and have it return the values that you want.