terça-feira, 26 de abril de 2016

BP Compendium 2: Variables

Variables



Variables are used to store values ​​of attributes of Blueprints that can be modified during the execution of the game. To create variables use the "MyBlueprint" tab and click the button with the "+" symbol next to the "Variables" category. The images below show the "MyBlueprint" tab and the variable types that exist in Unreal Engine.


Click to enlarge

The simplest types of variables are:
  • Boolean: A boolean variable can only hold the values ​​"true" or "false".
  • Integer: Type of variable used to store integer values​​.
  • Float: Type of variable used to store fractional values​​.
  • String/TextThese types are used to store text. Prefer the Text type since it supports internationalization.

In the image below an integer variable was created with the name "AmmoBox". This variable can be used in a Blueprint that represents an ammo box. Its value indicates the amount of ammunition that the player will receive.

The "Editable" option selected means that the variable can be changed in the level editor. The default value of this variable is 20, but the level designer can easily change the amount of ammunition of each box in the level.