This document is about: QUANTUM 2

Unity Integrations

The Quantum Golf Sample also provides a number a scripts to facilitate smooth gameplay interaction and viewing in Unity.


The CameraController handles the main camera movement. It has a _dummy Transform which is represents the position and rotation values the actual camera is lerping towards. The _target it follows is the GameObject with an EntityPrefabRoot component the camera is currently looking at; this GameObject reference is updated automatically when the Active entity of the global CurrentTurn is updated.

golf header

The controller reads player inputs to pan, tilt and zoom the camera.

  • Relative Position: the position of the camera relative to the target entity;
  • Relative Rotation: the amount of rotation added to the camera after it is positioned at the relative position and is looking at target entity;
  • Follow Target: determines if camera will follow the target entity when it is moving;
  • Lerp velocity: step factor used when lerping the actual camera towards the dummy transform;
  • Zoom Sensitivity: scale factor used when zooming in and out on the target entity;
  • Closest Distance: closest distance allowed when zooming in on the target entity;
  • Farthest Distance: farthest distance allowed when zooming out on the target entity;
  • Rotation Sensitivity: scale factor used when player is panning or tilting the camera;
  • Invert Rotation: mouse drag values are inverted before panning or tilting the camera;
  • Target clickable area radius: circle radius around target entity where it’s considered as clicking on it.


The UITurnClock script is responsible for polling the global CurrentTurns remaining turn duration from simulation when the CurrentTurn uses a timer and update the time displayed on the central clock panel.

golf header


The FairTimer script presents a pattern for displaying a more fair timer to the local player than a more realistic timer would. It takes into consideration the client’s RTT and/or its Input Offset.

N.B.: This does not interfere with anything on the simulation side. The current turn timer runs synced in every client, it is just the value displayed to the player that is changed proportionally to their lag. This is a configurable and optional feature and should be tweaked to reach the desired behaviour.

The FairTimer solution presented in the Quantum Golf Sample is gameplay agnostic and can be used in any timer based turn-based game with minor changes.


The UIStartCountdown script handles the visual timer countdown display at the center of the screen before the first turn begins.

golf header


The UIPlayerView is responsible for polling TurnData information for a given player and enabling / disabling / updating visual elements accordlingly. This includes:

  • increasing the turn Number when a player's turn has ended
  • changing the status text when a player’s status changes
  • making the skip button non-interactable when turn is inactive or the player is not local
  • updating player’s fillable ring timer
golf header


The UIScore script is responsible for enabling a score panel with the players’ scores info when a GameplayEnded event is raised by the simulation.

golf header
Back to top