Blueprint variables in Editor

Hi. I’ve made some static mesh framed wall paintings which I’ve nested inside a blueprint with a light above them. What I’d like to do is copy this blueprint around my level and then switch/toggle paintings in the editor to see what I prefer. It’s basically a quick way of iterating and requires one master blueprint than multiple paintings. I can get this working in-play mode by checking integer vars or bools against branches.

What I’d really like is to be able to quickly toggle through items-in-place (and see this in the editor). Is this possible?

Each asset type in UE4 is represented by specific class, for example static mesh is UStaticMesh so in blueprint it will be “StaticMesh”, make a object varable of that class and in property editor you will have static mesh selection, ofcorse you will still require code to swap the mesh when varable change, It’s hard to do it in blueprint as there no editor events in it but, Construction Script is triggered on every change of actor in editor so use that. Thsi won’t work on runtime, for runtime you would need to make a function for setting the mesh so that function would do the job.

In-game solution would require more work as you would need to gett all static mesh assets made make menu of it

Have you tried putting your customization code into the construction script?

If you create a light and set its color to a public variable in the construction script, when you change it in the Details tab the light will change its color in the editor. Every time you move the actor or change its properties, the construction scrip will fire and update your actor.

You can change the static mesh and any settings you like into the editor like that.

Here’s a screenshot with the behavior mentioned.

It is also valid to take a look at the documentation for construction scripts even if you have an idea of what it does.

Hope that helps you!

That’s great. Thank you both for your answers. I had a hunch it was to do with the Construction Script (for some reason I’d shy’d away from it - but after a quick play it’s super simple and similar to using the Event Graph).

@anonymous_user_f5a50610 - I was using a StaticMesh BP Actor Class / Parent but switched it to a generic actor class since I was getting hard crashes when setting some subtle animation on the light. I’d figured it was because there shouldn’t be animated children inside a class marked as static but I’m no longer able to reproduce the crashing bug.

I’ve got it working (see attached pic of it working and blueprint construction script) using an index variable (a public integer) that’s locked to the number of static meshes. I then test against a few branches and it works perfectly (though I’m sure a little more verbose than it needs to be). Is there a better way of doing it? I imagine that, when having a lot of meshes, this would be a long-winded way of doing things. Instead; perhaps I can access a drop down menu or enum (though I’m not sure exactly how I’d do it).


I actually had this same doubt about instantiating meshes, In Unity, for example, you can spawn them by their name which is awesome because you can just store an array of strings and connect them into your spawn code. I couldn’t find exactly that in UE4 or any way to do that yet, but haven’t searched a lot to be honest…