Is there any way to get a variable from another BP when constructed? I need to have a variable for each Level that has a Texture Object for the Material used.
I know it can be done at runtime but need to see it in the editor when building. The only other way I can think of is to create a child actor for each material look.
I don’t think that would do it. I want to be able to maybe even swap all materials for actors based on a variable. The main part of this is doing so in the construct script so I can see what I need to in the editor.
I’m wondering if there is a way to retrieve instead of just calling an Event using the BP Interface?
I have found a slight workaround using BP Interface as it can be called at construct … I have created an Actor placed in the Level with whatever variables I need and (at the moment) call an actor with the event and pass the variables, which works fine but I need it in reverse.
The construction script is a special place. It’s not a great place to interact with anything outside the object, because the object isn’t in the world yet. In fact, it might not ever be added to the world – it might be part of copy/paste, or the class default object, or something. I forget the exact rules, but there’s a reason it’s “special.”
If you need to set up things having to do with rendering and interaction with the world, “On Begin Play” is a much better place to do this.
When it comes to “being able to have custom values,” then you could either just create a bunch of child blueprints, that change the value appropriately, so they just come in the way you want them, or you can use the “Expose on Spawn” checkbox on a Variable, which lets whoever instantiates your blueprint, pass along the value they want.
If your use case is something like “all advertising signs in my city use a different texture based on game progression,” then one way to do that would be to put the state on the GameMode, and read that in On Begin Play for each of the signs.
Thanks, I understand the complexity. All objects placed in the Level via the Editor seem to already be in the world so can be referenced, so I’ve added a blank actor with the variables I need instead of trying GI GM which can only be at runtime. So far works ok, I didn’t even need the Interface