# How to edit Blueprint default variable via editor scripting?

**URL:** <https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701>\
**Category:** Editor Scripting\
**Tags:** UE4-24, unreal-engine, question\
**Created:** [January 20, 2022, 10:15am UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701 "2022-01-20T10:15:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![CabbageOni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CabbageOni](https://forums.unrealengine.com/u/CabbageOni)\
**Post date:** [January 20, 2022, 10:15am UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/1 "2022-01-20T10:15:00Z")

</div>

Hello, I’m trying to make an EditorUtilityWidget where if I press a button, it changes certain default values of a blueprint.

 ![how](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/3/c3f00a4923d543c56d3e67e0bdd100074bceeec6.png)

Is there a way to achieve this (possibly w/o c++)?

---

<div class="post-metadata">

**Author:** ![KristofMorva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kristofmorva/32/1194508_2.png) [@KristofMorva](https://forums.unrealengine.com/u/KristofMorva)\
**Post date:** [January 20, 2022, 11:27am UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/2 "2022-01-20T11:27:25Z")

</div>

The only semi-BP solution I remember is using the `SetEditorProperty` on the `ClassDefaultObject` (which I exposed from C++), but as far as I remember, this editor utility function was only added in 4.26.

![SetEditorProperty node](https://d3kjluh73b9h9o.cloudfront.net/original/3X/d/d/dd04b8a15da15ae1840707d32344cf5ed11ceed0.png)

---

<div class="post-metadata">

**Author:** ![UE\_FlavienP](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ue_flavienp/32/1194546_2.png) [@UE\_FlavienP](https://forums.unrealengine.com/u/UE_FlavienP)\
**Post date:** [January 20, 2022, 11:33am UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/3 "2022-01-20T11:33:48Z")

</div>

An alternative through python. You can run python script through blueprints.

```auto
import unreal

bp_object = unreal.EditorAssetLibrary.load_blueprint_class('/game/BP_Modif_Default')
bp_default_oject = unreal.get_default_object(bp_object)
bp_default_oject.set_editor_property("age",21)

```

---

<div class="post-metadata">

**Author:** ![CabbageOni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CabbageOni](https://forums.unrealengine.com/u/CabbageOni)\
**Post date:** [January 20, 2022, 12:04pm UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/4 "2022-01-20T12:04:37Z")

</div>

This seems to be the solution, yet I can’t test 'em since my project is at .24 ☹  
Might have to consider migrating, thanks a lot!

---

<div class="post-metadata">

**Author:** ![CabbageOni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CabbageOni](https://forums.unrealengine.com/u/CabbageOni)\
**Post date:** [January 20, 2022, 12:07pm UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/5 "2022-01-20T12:07:41Z")

</div>

Thank you for the suggestion, but I am looking for the in-EditorUtilityWidget availability as of now.

---

<div class="post-metadata">

**Author:** ![mindblender](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mindblender/32/598567_2.png) [@mindblender](https://forums.unrealengine.com/u/mindblender)\
**Post date:** [February 25, 2024, 4:00am UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/6 "2024-02-25T04:00:06Z")

</div>

Thanks! It worked! Exposing class defaults via C++ was a must.

---

<div class="post-metadata">

**Author:** ![deyama2012](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@deyama2012](https://forums.unrealengine.com/u/deyama2012)\
**Post date:** [June 25, 2024, 4:58pm UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/7 "2024-06-25T16:58:45Z")

</div>

I know it’s an old thread, but is there a way to set default values of actor components’ variables? It just doesn’t seem we have access to components through default object, right?

---

<div class="post-metadata">

**Author:** ![fael097](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fael097/32/250778_2.png) [@fael097](https://forums.unrealengine.com/u/fael097)\
**Post date:** [July 30, 2024, 7:33pm UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/8 "2024-07-30T19:33:48Z")

</div>

I’m trying to figure this out, but no dice yet.

A simple “this isn’t possible” would do

---

<div class="post-metadata">

**Author:** ![Kiry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kiry](https://forums.unrealengine.com/u/Kiry)\
**Post date:** [February 24, 2026, 12:49pm UTC](https://forums.unrealengine.com/t/how-to-edit-blueprint-default-variable-via-editor-scripting/273701/9 "2026-02-24T12:49:45Z")

</div>

Leaving info here for people who will come after me

Easiest Way it to expose some minor C++ functions that i could not find in BP:

- Access Actor Blueprint CDO needed to edit Blueprint default values .
- Access Components Templates to edit subcomponents default values within selected blueprint;

Expose using BPFL

> **C++ code**
>
> ```auto
> #pragma once
> 
> #include "CoreMinimal.h"
> #include "Kismet/BlueprintFunctionLibrary.h"
> 
> #include "Engine/SCS_Node.h"
> #include "Engine/SimpleConstructionScript.h"
> 
> #include "GridEditing_Statics.generated.h"
> 
> /**
> * 
> */
> UCLASS()
> class PROJECT_API UEditorHelper_Statics : public UBlueprintFunctionLibrary
> {
> GENERATED_BODY()
> 
> UFUNCTION(BlueprintCallable)
> static UObject* GetClassDefaultObject(TSubclassOf<UObject> InClass)
> {
> if (InClass)
> {
> return InClass->GetDefaultObject<UObject>();
> }
> return nullptr;
> }
>     
> UFUNCTION(BlueprintCallable)
> static TArray<UActorComponent*> GetComponentTemplatesFromActorClass(TSubclassOf<AActor> InActorClass, TSubclassOf<UActorComponent> InComponentClass)
> {
> if (InActorClass && InComponentClass)
> {
> if (UBlueprintGeneratedClass* ActorBlueprintGeneratedClass = Cast<UBlueprintGeneratedClass>(InActorClass))
> {
> if (auto ConstructionScript = ActorBlueprintGeneratedClass->SimpleConstructionScript)
> {
> TArray<UActorComponent*> ResultComp;
> for (const USCS_Node* const Node : ConstructionScript->GetAllNodes())
> {
> auto ComponentTemplat = Node->GetActualComponentTemplate(ActorBlueprintGeneratedClass);
>     
> if (ComponentTemplat && ComponentTemplat->GetClass() == InComponentClass)
> {
> ResultComp.Add(ComponentTemplat);
> }
> }
>     
> return ResultComp;
> }
> }
> }
>     
> return TArray<UActorComponent*>();
> }
> };
> 
> ```

To Edit Actor CDO with Bluetility

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/7/63764d319da835eccd5c4f11236d868d6c7371d6.png)

To Edit Component Templates with Bluetility

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/2/ab278ee7179a373540f994e374f0e4d0258ebb6b.jpeg)
