Skip to main content

Configure Game Variables

Luna Replay allows you to capture a single piece of gameplay footage, and create unlimited variations by changing anything visual within the game without needing to re-record footage.

When preparing your game in Unity, you are able to apply the LunaPlaygroundField 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.

This attribute will then surface these game variables when creating your replays, either in the Unity editor, or Luna Playground.

Please keep in mind that changing gameplay values which impact the timeline of events (i.e. speeds, physics, sizes) may impact the output, and cause discrepancies between the original capture. We recommend only changing variables which are visual and do not alter the game flow.


  1. Include using Luna.Replay.Playground; in the script(s) you wish to configure variables in.
  2. Apply the Luna LunaPlaygroundField attribute to your game variables
  3. Implement the ISerializationCallbackReceiver interface on a MonoBehaviour or 'ScriptableObject' where the variables are declared

Attribute Type#


This Luna attribute should be used for the scriptable game objects you wish to edit from Luna Playground.

  • Supported Types
    • String
    • Integer
    • Float
    • Color
    • Vector2
    • Vector3
    • Vector4
    • Enums
    • Bool


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

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

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


using Luna.Replay.Playground;
public class PlaygroundExample : MonoBehaviour, ISerializationCallbackReceiver {
[Header("Video Settings")][SerializeField][LunaPlaygroundField("Color of the player", 0, "Player Controls")]private Color playerColor =;
[SerializeField][LunaPlaygroundField("Enable UI", 0, "UI Controls")]private bool enableUI;
 public void OnBeforeSerialize() { }
 public void OnAfterDeserialize() { }

Playground Sections#

The LunaPlaygroundSection attribute can be applied to a class in order to add include all supported fields as Luna Playground Attributes.

For example:

[LunaPlaygroundSection("Player Controls", 0)]
public class Player : MonoBehaviour, ISerializationCallbackReceiver {
private Color playerColor =;

The result will mean that playerColor is exposed as a LunaPlaygroundField.