add_blueprint_variable
Adds a member variable to an Unreal Blueprint, defining its type, default, and optional array status so variable get/set nodes can read or write it.
Instructions
Add a MEMBER variable to a Blueprint (add_function_local_variable is the function-scoped twin), then read/write it with add_graph_node node_type=variable_get/variable_set. TRAP 1: the variable is born NOT editable per instance -- placing the actor and writing that variable fails with "cannot be edited on instances" -- and get_blueprint_variables reports instance_editable:true anyway; fix it with set_bp_variable_metadata(instance_editable=true). TRAP 2: on a class that ALREADY has actors placed in a level, those instances keep the value of the first compile, so a default set afterwards never reaches them -- verify on the instances, not on the CDO.
Returns: { blueprint_name, variable_name, variable_type, is_array } -- an echo of the request, NOT a verification: read the variable back with get_blueprint_variables (or the CDO) before relying on it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Optional. This command is REFUSED while a Play-in-Editor session is running: it either compiles a Blueprint (the reinstancer can retain a world, and CheckForWorldGCLeaks is Fatal -- it KILLS the editor) or writes to disk (Editor.AllowSavingAssetsDuringPIE=0 makes the engine refuse the write, so it would report success without writing a byte). Stop PIE and retry instead; force=true runs it anyway, at your own risk. | |
| is_array | No | When true, make the variable an array container; defaults to false. This is the ONLY array authoring path -- add_function_parameter has no equivalent. | |
| default_value | No | Initial default value for the new variable, in exported-text form; optional | |
| variable_name | Yes | New variable name (fails if the name already exists on this Blueprint). | |
| variable_type | Yes | Type string: bool, int, int64, float, string, name, text, byte, or the name/path of a struct, enum, class or object (e.g. Vector, /Game/Dir/S_Foo.S_Foo, /Script/Engine.Actor). | |
| blueprint_name | No | Blueprint name or path. | |
| blueprint_path | No | Alias of `blueprint_name` (same value, same meaning). Accepted because sibling tools spell this parameter differently; prefer `blueprint_name`. |