I’m learning blueprints and I have a quick question. I created a UObject blueprint. Is there a way to initialize a value when the object is instantiated? Do I need to create an actor blueprint for that or am I just missing something.
ahh ■■■■. i got the same problem. im not happy that there is no answer here.
im thinking about it, that when im constructing the object, i instantly call a custom event on it. sounds bad, but have no other idea how to manage it better
unreal constructors don’t take arguments, so, yes, if you must pass values to it, you’ll need to do that after it is constructed.
If you want to hide that under a layer, you could use a factory function that takes in parameters, creates the thing, then sets them on it, and returns the new thing
I have a text variable, i ticked these two flags, but it wont show up in the construct node.
by factory function you mean a function which lives in the Blueprint Function library?
well, a function somewhere. needs to be accessible to where it’s needed. could be in the same object, or in a function library, or some other object you can get at .
Choose the pertinent class from the dropdown first, then right click the node - Refresh Nodes
.
It should work as is, there is onClassPinChanged()
or whatshername but sometimes manually refreshing nodes is the way.