SF
STS Forge

Variables

Variable management verbs: add-var, remove-var, rename-var, set-var-default, set-var-flags, set-var-meta.

Back to AI Guide

Blueprint member variable management: create, read, remove, rename, set defaults, configure property flags, and set extended metadata.


read-var#

Read a variable's type, default value, and flags.

Category: Read (focused)

Args:

Arg Required Description
-asset= Yes Blueprint asset path
-name= Yes Variable name

Examples:

-verb=read-var -asset=/Game/BP/BP_Player -name=Health

Output:

{
    "success": true,
    "variable": {
        "name": "Health",
        "type": "Float",
        "category": "Stats",
        "replicated": false,
        "defaultValue": "100.0"
    }
}

On variable not found: error response lists available variable names.


add-var#

Add a new member variable to a Blueprint.

Category: Write (variables)

Args:

Arg Required Description
-asset= Yes Blueprint asset path
-name= Yes Variable name
-type= Yes Pin type (see Type Names below)
-subtype= No Object/struct/enum class name (required when type is Object, Struct, or Enum)
-container= No Container wrapper: array, set, or map
-keytype= No Map key type (required when container=map)
-keysubtype= No Map key class (required when container=map and keytype is Object/Struct/Enum)
-category= No Variable category string for editor organization
-replicated No Flag (presence-only): mark variable as replicated (CPF_Net)
-tooltip= No Variable tooltip text for editor hover
-compile No Flag: also compile after the write
-save No Flag: also save to disk after write

Type names: bool, float, int, int64, byte, String, Name, Text, Vector, Rotator, Transform, LinearColor, Object, Class, SoftObject, Enum, Struct

For Object/Struct/Class/Enum types: use -subtype= with a path like /Script/Engine.Actor or a short name like Actor.

Examples:

-verb=add-var -asset=/Game/BP/BP_Enemy -name=Health -type=float
-verb=add-var -asset=/Game/BP/BP_Enemy -name=Inventory -type=Object -subtype=/Script/Engine.Actor -container=array
-verb=add-var -asset=/Game/BP/BP_Enemy -name=MaxHealth -type=float -category=Stats -tooltip="Maximum health" -compile -save
-verb=add-var -asset=/Game/BP/BP_Enemy -name=TagMap -type=String -container=map -keytype=Name
-verb=add-var -asset=/Game/BP/BP_Player -name=TeamColor -type=Struct -subtype=/Script/CoreUObject.LinearColor -replicated

Idempotent: if a variable with the same name already exists, returns its details with "action": "already_exists" (no error, no modification).

Output:

{
    "success": true,
    "action": "created",
    "variable": {
        "name": "Health",
        "type": "Float"
    }
}

remove-var#

Remove a member variable by name.

Category: Write (variables)

Args:

Arg Required Description
-asset= Yes Blueprint asset path
-name= Yes Variable name to remove
-compile No Flag: also compile after the write
-save No Flag: also save to disk after write

Examples:

-verb=remove-var -asset=/Game/BP/BP_Enemy -name=OldHealth

Idempotent: if the variable does not exist, returns success with "action": "already_absent".

Output:

{
    "success": true,
    "action": "removed",
    "remainingVariables": ["Health", "Speed"]
}

set-var-default#

Set the default value of an existing variable.

Category: Write (variables)

Args:

Arg Required Description
-asset= Yes Blueprint asset path
-name= Yes Variable name
-value= Yes Default value as string (e.g., "100.0", "true", "(X=1,Y=2,Z=3)")
-compile No Flag: also compile after the write
-save No Flag: also save to disk after write

Examples:

-verb=set-var-default -asset=/Game/BP/BP_Enemy -name=Health -value=100.0
-verb=set-var-default -asset=/Game/BP/BP_Player -name=bIsAlive -value=true
-verb=set-var-default -asset=/Game/BP/BP_Player -name=SpawnOffset -value="(X=0,Y=0,Z=100)"

Output:

{
    "success": true,
    "variable": {
        "name": "Health",
        "defaultValue": "100.0"
    }
}

rename-var#

Rename a Blueprint member variable.

Category: Write (variables)

Args:

Arg Required Description
-asset= Yes Blueprint asset path
-name= Yes Current variable name
-newname= Yes New variable name
-compile No Flag: also compile after the write
-save No Flag: also save to disk after write

Examples:

-verb=rename-var -asset=/Game/BP/BP_Enemy -name=HP -newname=Health -compile -save

Output:

{
    "success": true,
    "oldName": "HP",
    "newName": "Health"
}

Notes:

  • All graph references to the variable (Get/Set nodes) are updated automatically.
  • Fails if a variable with the new name already exists.

set-var-flags#

Set property flags and metadata on a variable.

Category: Write (variables)

Args:

Arg Required Description
-asset= Yes Blueprint asset path
-name= Yes Variable name
-flags= Yes Comma-separated flag names (see Supported Flags below)
-category= No Variable category string
-tooltip= No Variable tooltip text
-repnotify= No RepNotify function name (used with the Replicated flag)
-compile No Flag: also compile after the write
-save No Flag: also save to disk after write

Supported flags: EditAnywhere, EditDefaultsOnly, EditInstanceOnly, VisibleAnywhere, VisibleDefaultsOnly, VisibleInstanceOnly, BlueprintReadOnly, BlueprintReadWrite, Replicated, Transient, SaveGame, AdvancedDisplay, Interp, ExposeOnSpawn

Examples:

-verb=set-var-flags -asset=/Game/BP/BP_Enemy -name=Health -flags=EditAnywhere,BlueprintReadWrite
-verb=set-var-flags -asset=/Game/BP/BP_Enemy -name=Health -flags=Replicated -repnotify=OnRep_Health
-verb=set-var-flags -asset=/Game/BP/BP_Player -name=MaxHealth -flags=EditDefaultsOnly,BlueprintReadOnly -category=Stats -tooltip="Maximum health pool"

Output:

{
    "success": true,
    "variable": {
        "name": "Health",
        "flags": ["EditAnywhere", "BlueprintReadWrite"]
    }
}

Notes:

  • Flags are applied additively on top of existing flags. To clear a flag, omit it and set only the flags you want active.
  • When using Replicated with -repnotify=, the specified function must exist in the Blueprint (create it first with add-function if needed).

set-var-meta#

Set extended metadata on a variable (numeric clamps, UI slider settings, edit conditions, replication conditions).

Category: Write (variables)

Args:

Arg Required Description
-asset= Yes Blueprint asset path
-name= Yes Variable name
-clampmin= No Numeric: minimum clamp value
-clampmax= No Numeric: maximum clamp value
-uimin= No Numeric: UI slider minimum
-uimax= No Numeric: UI slider maximum
-sliderexponent= No Numeric: slider exponent for non-linear slider response
-editcondition= No Edit condition expression (e.g., "bUseCustomHealth")
-displayname= No Display name override shown in the editor
-makeeditwidget No Flag (presence-only): enable 3D edit widget for transform properties
-repcondition= No Replication condition (see Supported Values below)
-compile No Flag: also compile after the write
-save No Flag: also save to disk after write

Supported repcondition values: None, InitialOnly, OwnerOnly, SkipOwner, SimulatedOnly, AutonomousOnly, SimulatedOrPhysics, InitialOrOwner, Custom, ReplayOrOwner, ReplayOnly, SimulatedOnlyNoReplay, SimulatedOrPhysicsNoReplay, SkipReplay, Dynamic, Never

Examples:

-verb=set-var-meta -asset=/Game/BP/BP_Enemy -name=Health -clampmin=0 -clampmax=1000 -uimin=0 -uimax=500
-verb=set-var-meta -asset=/Game/BP/BP_Enemy -name=Health -repcondition=OwnerOnly
-verb=set-var-meta -asset=/Game/BP/BP_Player -name=SpawnLocation -makeeditwidget
-verb=set-var-meta -asset=/Game/BP/BP_Enemy -name=CustomDamage -editcondition=bUseCustomDamage -displayname="Damage Override"

Output:

{
    "success": true,
    "variable": {
        "name": "Health",
        "metadata": {
            "ClampMin": "0",
            "ClampMax": "1000",
            "UIMin": "0",
            "UIMax": "500"
        }
    }
}

Notes:

  • Metadata keys are only set for the arguments you provide. Omitted arguments leave existing metadata unchanged.
  • -repcondition= only takes effect on variables that have the Replicated flag set via set-var-flags.
  • -sliderexponent= values greater than 1 skew the slider toward the minimum, values less than 1 skew toward the maximum.

Example: replicated health variable (batch)#

A common pattern is creating a fully configured replicated variable in a single batch operation. This example creates a Health float variable with a default value, editor flags, numeric clamps, and owner-only replication.

{
  "defaultAsset": "/Game/Blueprints/BP_Character",
  "operations": [
    {
      "verb": "add-var",
      "args": {
        "name": "Health",
        "type": "float",
        "category": "Combat",
        "replicated": true,
        "tooltip": "Current health. Replicated to owning client only."
      }
    },
    {
      "verb": "set-var-default",
      "args": {
        "name": "Health",
        "value": "100.0"
      }
    },
    {
      "verb": "set-var-flags",
      "args": {
        "name": "Health",
        "flags": "EditAnywhere,BlueprintReadWrite,Replicated",
        "repnotify": "OnRep_Health"
      }
    },
    {
      "verb": "set-var-meta",
      "args": {
        "name": "Health",
        "clampmin": "0",
        "clampmax": "200",
        "uimin": "0",
        "uimax": "200",
        "repcondition": "OwnerOnly"
      },
      "compile": true,
      "save": true
    }
  ]
}

What this does:

  1. add-var: creates a float variable named Health in the Combat category, marked replicated.
  2. set-var-default: sets the default value to 100.0.
  3. set-var-flags: configures editor visibility (EditAnywhere, BlueprintReadWrite), replication (Replicated), and binds the OnRep_Health function as the RepNotify callback.
  4. set-var-meta: clamps the value between 0 and 200, sets the UI slider range, and restricts replication to the owning client (OwnerOnly).

The final operation includes compile and save flags so the Blueprint is compiled and saved to disk after all four operations complete.

HTTP invocation:

curl -X POST http://localhost:7850/baa/v1/batch \
  -H "Content-Type: application/json" \
  -d @health-var-batch.json

Commandlet invocation:

UnrealEditor-Cmd.exe <Project>.uproject -run=BlueprintAIAssistant \
  -verb=batch -file=health-var-batch.json -nullrhi -nosplash -nosound -unattended