How to edit Blueprint default variable via editor scripting?

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

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

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

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

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)
1 Like

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

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