# Set instance variables values as class default

**URL:** <https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491>\
**Category:** Community & Industry Discussion\
**Tags:** variables, Class, instance, child, unreal-engine, editor, question\
**Created:** [November 12, 2018, 3:18pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491 "2018-11-12T15:18:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gamji](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamji](https://forums.unrealengine.com/u/Gamji)\
**Post date:** [November 12, 2018, 3:18pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/1 "2018-11-12T15:18:18Z")

</div>

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?**

---

<div class="post-metadata">

**Author:** ![MajinSephiroth](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MajinSephiroth](https://forums.unrealengine.com/u/MajinSephiroth)\
**Post date:** [November 12, 2018, 9:56pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/2 "2018-11-12T21:56:41Z")

</div>

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

![259215-capture2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/e/1/ee1140b4e821a1ef6d277bca39b81eb62938c0fb.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.

 ![259216-capture3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/6/3b64bac598a4bc57f1e43488548829bd7a39c604.png)

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.

---

<div class="post-metadata">

**Author:** ![Gamji](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamji](https://forums.unrealengine.com/u/Gamji)\
**Post date:** [November 13, 2018, 5:05pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/3 "2018-11-13T17:05:49Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Ego\_Studio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ego\_Studio](https://forums.unrealengine.com/u/Ego_Studio)\
**Post date:** [November 13, 2018, 5:19pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/4 "2018-11-13T17:19:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gamji](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamji](https://forums.unrealengine.com/u/Gamji)\
**Post date:** [November 13, 2018, 6:21pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/5 "2018-11-13T18:21:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MajinSephiroth](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MajinSephiroth](https://forums.unrealengine.com/u/MajinSephiroth)\
**Post date:** [November 15, 2018, 4:13pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/6 "2018-11-15T16:13:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gamji](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamji](https://forums.unrealengine.com/u/Gamji)\
**Post date:** [November 26, 2018, 1:01pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/7 "2018-11-26T13:01:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MajinSephiroth](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MajinSephiroth](https://forums.unrealengine.com/u/MajinSephiroth)\
**Post date:** [November 26, 2018, 7:31pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/8 "2018-11-26T19:31:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pedro\_Cori](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pedro\_Cori](https://forums.unrealengine.com/u/Pedro_Cori)\
**Post date:** [September 11, 2021, 11:41pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/9 "2021-09-11T23:41:26Z")

</div>

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.

 ![348440-blueprint-apply.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/2/3f2bb0070d781db4575b8cdcd278da8e5964f518.png)

---

<div class="post-metadata">

**Author:** ![SocketPop](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SocketPop](https://forums.unrealengine.com/u/SocketPop)\
**Post date:** [May 20, 2022, 4:03pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/10 "2022-05-20T16:03:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BIGTIMEMASTER](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bigtimemaster/32/710746_2.png) [@BIGTIMEMASTER](https://forums.unrealengine.com/u/BIGTIMEMASTER)\
**Post date:** [May 20, 2022, 6:44pm UTC](https://forums.unrealengine.com/t/set-instance-variables-values-as-class-default/437491/11 "2022-05-20T18:44:40Z")

</div>

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

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/5/1b581bac06bbec2e9b9b6587c40f9ecb9e6b1579.png)

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.
