Skip to main content

Configure Game Variables

With Luna Playground, anyone will be able to create unlimited playable ad variations in a matter of seconds without having to touch your code or rebuild the project.

When preparing your game in Unity, you are able to apply the LunaPlaygroundField or LunaPlaygroundAsset attribute to any serializable field (i.e. public fields of MonoBehaviours and ScriptableObjects or fields marked with SerializeField attribute) and it will be surfaced in the playable editor in Luna Playground. These fields should be used within your game code so that the default values are overridden when the game is initialised.

Attribute Types#


This is the most common Luna attribute, and should be used for the scriptable game objects you wish to edit from Luna Playground. For example, you will want to use this for all text and colors for the end card.

  • Supported Types
    • String
    • Integer
    • Float
    • Color
    • Vector2
    • Vector3
    • Vector4
    • Enums
    • Bool
    • Range slider (see below for how to implement)
    • Arrays of the above types (e.g. String[], Int[] etc.)

To see how to set the maximum and minimum length for an array field, click here.


This should be used when you want to create multiple variations of your ads with different textures or videos, but don't want to increase the overall build size. When using this attribute, you will be able to upload images or videos directly in Luna Playground. For example, you may wish to change the game icon for your end card.

LunaPlaygroundAssets must be assigned a default value in Unity. Assets without a default value will not be shown in Luna Playground.
  • Supported Types
    • Image or texture (.png, .jpg, .jpeg)
      • In Unity, please use Texture or Texture2D
    • Video (.mp4)
      • In Unity, please use Video.VideoClip
    • Font (.ttf)
      • In Unity, please use UnityEngine.Font
Please keep in mind that due to technical specifics of implementation, all instances of a class with variation-controlled fields will receive an updated value. That is fine for Scriptable Objects (because those normally exist as a single instance anyway), but might be a surprise for Mono Behaviours.

For example; referencing the same texture as a LunaPlaygroundAsset in two separate scripts will result in one combined field in Playground.

LunaPlaygroundFieldStep (Range Slider)#

This attribute allows you to define a range of values (min and max) that can be applied to an int or float value, as well as the cardinality of this range (i.e the number of increments).

In Luna Playground, this will be represented as a slider.

For example:

[LunaPlaygroundFieldStep(0.5f)][LunaPlaygroundField("Amount of lives", 0, "Game Settings")][Range(0, 10)]public float someFloat

This will add a range slider to Playground that allows values inclusively between 0 & 10, and will increment between them by 0.5 at a time.


This attribute allows you to create an array and add/remove values in Luna Playground, for example, adding new characters to a scene. You must define the the minimum and maximum objects for the array.

For example:

[LunaPlaygroundFieldArrayLength(1, 5)][LunaPlaygroundField("Character Names", 0, "Game Settings")]public string[] characterNames;

This will add an array of strings to Playground that allows at minimum 1 string, and a maximum of 5.


For each Playground Field, you can specify the title, group and field order.

[LunaPlaygroundField("Field title", 0, "Group title")]

  • Field title: The name of the field in Playground i.e. "End card title"
  • Field order: The order of the field in Playground
  • Field section: The name of the group to which the field belongs i.e. "End Card"


[Header("Playable Ad Settings")][SerializeField][LunaPlaygroundField("Color of the player", 0, "Player Controls")]private Color playerColor =;
[SerializeField][LunaPlaygroundField("Speed of the player", 1, "Player Controls")] private float playerSpeed = 1f;
[SerializeField] [LunaPlaygroundField("Number of levels", 2, "Game Controls")] private int gameLevels = 1;
[SerializeField][LunaPlaygroundField("Relative game difficulty", 3, "Game Controls")]private int gameDifficulty = 3;
[SerializeField][LunaPlaygroundAsset("Game Icon", 4, "End Card")]private Texture gameIconTexture;
[SerializeField][LunaPlaygroundAsset("Video Clip", 5, "End Card")]private VideoClip videoClip;

Playground Sections#

The LunaPlaygroundSection attribute can be applied to a class in order to add all Luna Fields and Assets into the same Playground section, making it easier to organise your fields in Luna Playground.

The Playground section will be overridden by the optional parameter, "FieldSection", of a LunaPlaygroundField or LunaPlaygroundAsset attribute.

For example:

[LunaPlaygroundSection("Player Controls", 0)]
public class Player : MonoBehaviour {
[SerializeField][LunaPlaygroundField("Color of the player", 0)]private Color playerColor =;

[SerializeField][LunaPlaygroundField("Speed of the player", 1)private float playerSpeed = 1f;}

Recommended variables#

We recommend at a minimum, to use the LunaPlaygroundField attribute for:

  • Call to action colors
  • Call to action text values.
  • In-ad messages such as those found in end cards or tutorials.