So I’ve been searching through documentation and trying to find an answer to what I’m assuming is pretty simple, but I’m not having any luck.
I have an actor blueprint which contains only a point light. I’ve setup 4 variables as well as some curves for controlling those values in a flickering action. If I drag this blueprint into my scene, I’ve exposed the variables so I can edit them right there in the editor. This way I can control the brightness, light radius, etc. per instance.
I have then taken that blueprint, and placed inside of a parent blueprint which contains a torch model and a particle system. I can access those same variables I setup when I’m editing inside the blueprint from the Child Actor Template section of the details panel. However, when I drag this parent blueprint into my scene, I cannot control the variables in the editor anymore, so I have no way of making certain torches brighter, etc.
How do I get these variables exposed on the parent blueprint so that I have access to edit them per instance in the editor? Have I gone about this in completely the wrong way? I appreciate any help or insight anyone can give!
@Grot13 thank you so much for a quick response and for even providing a quick example blueprint to illustrate how to accomplish this. Now I can re-utilize my light blueprint into all sorts of different torches that require it to be in different positions and with different values. You seriously rock!
I implemented this structure and everything is functioning as expected. Thanks again!
@Grot13@IamBramer please excuse the tagging, but i am interested in the solutions you guys are referencing, but frsutratingly I cannot see those answers, only the responses discussing them can somebody please post the solution?
Hi !
Grab your child actor component into your graph. Then drag from it and search for a node called “child actor”. You can plug it to your cast node (cast to the class of the actor component) and get your variables/function/events from it
The variables dont get reflected to the scene .
Similar problem has been described in this thread, but the solution is a bit hacky, and I’m not sure I fully understand it. is there a better method of getting around this.
thanks for the swift reply.
the problem I’m facing is that the modifications/functions performed in the constructor of the “baby blueprint” are not getting refreshed when the baby variable(s) are edited from the parent blueprint.
I’ve read previously that best way to come around this is to create a “constructor function” and have it called from the parent as to get the refreshed baby component (such as you did with the “lamp function”). Did I get this right? (p.s. I’m absolute newb so still trying to understand the overall workflow).
Yes you get it right. While in construction, the variable modification won’t affect the child construction, but wrapping all your construction inside of one function and call this function in the parent construction will do the job
to take just a bit more of your time, I guess, alternative would be to dynamically create the child BP and assign it as a new/existing component (that way the child constructor would get called?)
No, if you add the child component at runtime, it won’t call the construction either (at least not with parameters changed from the parent). Forget about the child construction script, put everything in a “construct” function that will replace the construction script.
It is not complex nor time consuming (just have to call it in the parent’s constructor), and you are guaranteed it works. You can still plug this function in the constructor in case you need the child class without parent since in this case the constructor will be called and execute the function, with its own parameters
thanks. I dont mind doing as you’ve said. I just wanted to have an assurance that I’m not messing something up when trying it on my own.
I’ve only just started learning BP so I wanna know as many “dont do this” patterns as possible.
Alternative is spending time trying to debug something that’s not supposed to work in the first place.
if you have any more “Dont do this” worth knowing let me know.
Hmmm thanks guys I am starting to get it. Though I am having trouble assigning from a variable to a child actor.
As an example, I have a parent blueprint which is made up of two child actors, a cube and a point light. I want to expose a variable in the parent blueprint which will affect the color of the child point light. I’ve done it like this:
However it is not really working well, the light is staying yellow when it should be pink (the overridden value). I have seen it “sometimes” work, kinda feels like a race condition. It works perfectly if I have the same nodes coming off the Event BeginPlay for example. Could be some issue with the construction order between the parent and the child actor?
I think your cast is wrong. Your light BP is called “MyBPLight” as I can see on the content browser, and I guess it is the class assigned to the child component. You must cast to this class, so you should have a “cast to MyBPLight” instead of a “cast to point light”.
Then grab the light component of this class, it should be named “point light” if you haven’t renamed it, and not simply " light component.
However I couldn’t explain why it works on begin play…
Edit : I advise you to alway have same prefixes for better clarity, “BP_NameOfTheBlueprint” for example, this way when you use cast node you directly know if you are casting to a blueprint class instead of casting to a component
Thanks, I appreciate you taking the time to repro this. However in the example I’d posted, the child actor was just an actor of class “PointLight”, not a blue print:
The cast seems to be working as it reaches the “success” print string. (I did also try wrapping it in a blueprint class as you’ve done and it does work correctly there). Perhaps something goes wrong between the cast and the set color, though blueprint doesn’t flag any warnings / errors
(this is something of an aside though as thanks to your help, the actual blueprint example does work :))