Learn

Chapter 04 Variables & Data Types

#040 Break Struct

Your weapon struct holds four values. The ammo counter needs just one. Break Struct hands it over.

  • 1:47 video
  • Written lesson
  • Beginner
Video lesson: Break Struct, 1:47

Struct in, members out

Break takes a struct in, and gives one output per member. Drag from any struct pin and search for Break, followed by the struct name.

It’s pure: no exec pins. It reads the struct every time a connected node runs.

  • Too many pins? Select the node, untick unused members in Details, and those pins hide.
  • Or skip the node: Split Struct Pin works on outputs too.
  • Break also pairs with Make: break the old value, change one member, and make the new one.

Example: a weapon display

Current Weapon goes into Break S Weapon. Name feeds the weapon label, and Ammo feeds the counter: Plasma Rifle, twenty. Switch to the Shotgun, and the same Break now shows six rounds.

One Break can feed several nodes: the label, the counter, and the reload warning.

Break Vector, Break Rotator and Break Transform work exactly the same way.

Chapter four recap: variables and data types

  • Booleans answer yes or no. Integers count, and floats measure.
  • Vectors say where, Rotators say which way, and Transforms bundle both, plus scale.
  • Enums allow one named state, and Switch on Enum routes each one.
  • Structures group related values. Make packs them, and Break unpacks them.

Every value your game stores is one of these types, or a mix of them.

Three final tips

  • AND reads both inputs, so check Is Valid with its own Branch.
  • Never compare floats with exact equals. Use Nearly Equal, or less than.
  • Get from an array returns a copy. Write changes back, or return a reference.

Next, chapter five: functions and collections, starting with function inputs.

In short

Struct in, members out.

Covered in this lesson

  • Break Struct
  • Split Struct Pin
  • Make Struct
  • Break Vector
  • Break Rotator
  • Break Transform
  • Is Valid
  • Nearly Equal

Newsletter

Development updates are coming to your inbox.

The newsletter opens soon. Until then, new lessons, tools and Beach Hunters progress appear first on our channels, linked below.