Set instance variables values as class default

Hi all,

I’ve got a map generation blueprint that I can just drag into the world and edit to create a grid based map. By creating children of this blueprint, I was hoping to be able to drag them in and edit them in editor and have the variables be saved in the child blueprint. But then I realised that variables of an instance are different from the default class ones.

Is there any way to update a blueprint’s default variables from an instanced version of it, the same way we would update a prefab in unity?

I don’t know how things work in Unity, but if you make variables to be instance editable

259215-capture2.png

You will have access to them in the world outliner, that way you will be able to set values on a per-level basis.

If you plan on spawning them via blueprint into your level make sure that it’s exposed to spawn, that way you will be able to set those values when you call the spawn function on that particular child.

So that’s what I’ve been doing, because I made it to be some sort of level design tool, anyone using will need to be able to do a lot of tweaks and quick changes, and given that there’s quite a few variables to set, doing so from the blueprint, compiling and then checking the result is just to unpractical.

Per example in your screenshot, would it be possible to save the value of “Holo Mat” as the default for BP_HoloController without opening the blueprint and manually set it as the default value ?

I don’t know much about Unity neither but I just read about Prefab and it sound like interesting. Why don’t you send a feature request to UE.

I might actually, feels weird to be the only one having this issue tho aha!

I’m not that experienced in Unity, but from what I gathered an instanced prefab (kinda the equivalent to an actor class) can be modified via the viewport and you can apply those changes to the prefab class. Although it doesn’t change the default values set in code, they are saved in that prefab meaning that if you were to delete the instance and create a new one, it’ll still have all the values you’ve set.

Not sure what the reasoning would be to modify defaults outside of the blueprint editor, I personally don’t see value in it. From a programming standpoint, you create default values when you anticipate them not to require changing on the fly. Children inherit the default values and can be individually set to their own defaults as well.

Maybe child blueprints are what you’re looking for.

In the example that I gave above, if I create a child of BP_HoloController and modify the HoloMat on the BP_HoloController_Child then they will each have their own individual defaults while having the same functionality.

Wanting to modify the defaults and saving those defaults without editing the blueprint seems kind of an odd practice in my opinion.

It simply eases the tweaking of the variables. So for a child blueprint, instead of opening it, changing the values, compiling and then pressing play, you’d just need to select the instance, change the variable in the details panel and pressing play. Those values would then be applied to the child’s defaults ones.

It’s not something that is absolutely necessary but i feel it would help people like me who are building maps from a class in editor, meaning that compile times takes a bit longer than your typical blueprint.

If all you need is modifying variables after having it placed in level it’s already available by default. Taking into consideration the aforementioned example of BP_HoloController, if you drag two instances into the world, you can select them individually in the level and make one have a HoloPeriod of 10 while the other have a HoloPeriod of 12. This does not require you to save and re-compile a blueprint. From that point onwards you can just copy and paste them in your level with the new values.

Since this is still the #1 Google result about applying Blueprint instance changes to the base Blueprint and it still doesn’t have an answer (only unhelpful comments about how it would be a useless feature), I’m reviving it. It’s absolutely a valuable feature and can be done by selecting the Blueprint instance in the World Outliner, then hitting the “Edit Blueprint” button and then the “Apply Instance Changes to Blueprint” option from the dropdown menu.

5 Likes

Thank you for this answer. I originally created a class with a large Blueprint Struct in it, that I later decided needed to be a C++ struct instead, but I already had several Blueprint classes with this data set up in them using the old struct. I could not copy from the old struct to the new in the default properties, so I added a Blueprint construction script that copied all the properties over. This meant that instances had the properties set up in the new struct, but I couldn’t figure out how to save those changes to the default properties. Apply Instance Changes to Blueprint was exactly what I needed.

Not directly related, but when working with inherited classes you may find this handy:

image

For instance, you are making the same function on multiple child classes so you decide it could go to the parent. Here is the one click solution.