In this tutorial, we'll take a look at Attributes in GameSalad. Attributes are one of the most powerful aspects of GameSalad. They are essentially value-holders; they're designed to store numerical or text values to be used for different situations. They can easily be used for anything from the angle at which a cannonball is launched to displaying the name of a character in a game to recording a rapidly-changing score. Understanding how to use Attributes properly is crucial to unlocking the full power of GameSalad.
Attributes are essentially variables. Any time you need to record a number (or an angle, or a piece of text), creating a new attribute is probably the best way to do it. If you're struggling with this concept, focus on the numeric aspect of attributes. For instance, say you're building a racing game. Creating an attribute to record the speed of your racer gives you the flexibility to easily change that speed in a way that can be referenced in a variety of situations, such as accelerating, braking, and collisions. At the same time, another attribute might be used to record the amount of time it takes to go around the track, or your final score.
GameSalad comes with a large number of existing attributes in every game project, storing information about actors, scenes, and the game itself. These preset list of attributes control certain base activities, such as scene size, actor motion, and game time. There are also options for creating custom attributes for any information you may wish to store as the developer. We'll touch on existing attributes briefly, and then discuss how to use custom attributes for anything in your game.
Attributes exist for your game, your scenes, and your actors. Game attributes can be accessed by all actor prototypes and instances so that they can be seen in any scene. Scene attributes can only be accessed in a particular scene but all actor instances in that scene can individually be edited to view, use, and modify those scene attributes. Actor attributes can only be accessed by an actor instance, but can be initially defined and used in an actor prototype so that all instance of that prototype can have predefined behaviors.
There are six different types of attributes:
Existing attributes in your game can be viewed in the Scene editor (in the Inspector, chose either the "Game" or "Scene" tab, and then the "attributes" tab below) and in the Actor editor (the left-hand side contains a list). These existing attributes record data about your game, scene, and actors, such as their size, location, color, and more. However, custom attributes contain data that is unique to your game - how fast your race car is moving, or how many blocks remain in a puzzle. Simply click the "+" button at the bottom of any list of attributes, and rename as desired.

Because you'll be accessing the value held by this attribute from actor behaviors, rename it something that makes sense to you and you'll be able to remember later - such as "race car speed", or "blocks remaining". At times, you'll want to record the location of an actor - you can do this through attributes as well, and these attributes might be named something like "PlayerX" and "PlayerY", to record the X and Y coordinates of the player.
To reference an attribute once you've created it, use the expression editor ("e") or attribute browser ("...") in any behavior.


Wrap-up Questions for Attributes in GameSalad