Knowledge base
Knowledge base
Knowledge base
Free, anonymous browsing of Unreal Engine Blueprint examples, node references, and best practices. The same content the WoalzCraft plugin uses to generate Blueprints.
66 results for Variable
Variable node pin naming rules in UE5 Blueprints: - GetVariable: PURE node — NO exec pins. Single output pin named exactly after the variable (e.g. 'Health'). - SetVariable: exec in='execute', exec out='then'. Input pin named exactly after the variable (e.g. 'Health'). Output pin named exactly after the variable (returns new value). - Variable names ARE case-sensitive in connections. 'MyHealth' != 'myhealth'. - When connecting to SetVariable, the input pin name MUST match variable_name exactly.
Why: The variable '{name}' is typed as something that no longer exists in your project. This happens when you delete or rename a Blueprint, Struct, or Class that other variables referenced — UE5 leaves the reference dangling. Fix: Open the Blueprint that owns '{name}' (in the Errors panel, click the file link). In My Blueprint panel, click '{name}' to select. In Details panel, change Variable Type to a valid type, or delete the variable entirely and remove all references.
Why: You created a local variable '{var}' inside this function, but no node ever reads it after assignment. It's just dead code. Fix: Either: (a) delete the variable and the Set node that writes to it, or (b) add a Get '{var}' node and connect it to wherever you actually need the value (if this was an oversight).
When connecting GetVariable or SetVariable nodes, the pin name must exactly match the variable_name field. E.g. variable 'MyHealth' → pin name 'MyHealth'. SetVariable exec input pin is always 'execute', not 'Execute' or 'in'. GetVariable has no exec pins — it is a pure data node.
Reads a variable's current value. Drag a variable from the My Blueprint panel and choose Get.
Pattern: GetPlayerCharacter(PlayerIndex=0) → CastTo<BP_MyCharacter>(Object=ReturnValue) → Cast Succeeded → Get/Set variables on 'As BP_MyCharacter' output pin. Key: CastTo exec input='execute', exec output='Cast Succeeded'/'Cast Failed'. The cast output pin is named 'As BP_MyCharacter' (or whatever your class is). Connect this output to any node that needs the typed reference.
Variables: CurrentState (your EState enum: Idle, Patrol, Chase, Attack, Dead). EventTick or custom Update event → Switch on EState(CurrentState) → Idle: [idle logic] → Patrol: [patrol logic] → Chase: [chase logic] etc. State transitions via custom events: OnEnemySpotted → SetVariable(CurrentState=EState::Chase). OnEnemyLost → SetVariable(CurrentState=EState::Patrol). OnDamaged → Branch(Health<=0) → True: SetVariable(CurrentState=EState::Dead). Key: Switch On Enum node — connect enum variable to the input, each value gets an exec output pin.
Why: Your code reads from a '{ref}' reference, but nothing was assigned to it. UE5 doesn't error at compile time, but warns that the runtime access will crash with null-pointer. Fix: Wherever this BP spawns, set the reference via Spawn Actor From Class → Set Reference. If it should be set from outside, expose the variable (eye-icon = Instance Editable) so it's set in the level editor. Add an Is Valid? Branch before each read to gracefully handle null.
A named storage slot for a value. Has a type (Boolean/Integer/Float/String/Vector/Object Reference/etc) and a default value.
Why: Your code reads '{var}' on a client expecting it to match the server's value, but '{var}' isn't marked Replicated — clients only see whatever default they spawned with. Fix: Open the Blueprint. My Blueprint panel → click '{var}' → Details panel → scroll to Replication section → set 'Replication' to 'Replicated' or 'RepNotify' (RepNotify lets you trigger a function on each replication event).