Game state and properties#
Commands that read and change text, scenes, properties and time scale, and save the game state or a screenshot.
Every command also takes the global options, such as --host and --port.
get-text#
Gets the text content of a UI element.
Parameters
Name |
Required |
Description |
|---|---|---|
value |
Yes |
The object name or locator value. |
|
No |
Locator strategy. The default value is: |
|
No |
Locator strategy for the camera. The default value is: |
|
No |
Camera locator value. |
Returns
The text content of the element as a string.
Examples
alttester get-text ScoreLabel
alttester get-text --by PATH //Canvas/Header/Title
set-text#
Sets the text of an input field.
Parameters
Name |
Required |
Description |
|---|---|---|
value |
Yes |
The object name or locator value. |
|
Yes |
The text to set on the input field. |
|
No |
Locator strategy. The default value is: |
|
No |
Locator strategy for the camera. The default value is: |
|
No |
Camera locator value. |
Returns
Confirmation.
Examples
alttester set-text UsernameInput --text "player1"
scene#
Gets the current scene name, lists all loaded scenes, or loads a scene by name.
Parameters
Name |
Required |
Description |
|---|---|---|
|
No |
If set, returns all currently loaded scenes instead of just the active one. |
|
No |
Name of the scene to load. |
Returns
The current scene name by default. A list of scene names when using
--list. Confirmation when using--load.
Examples
alttester scene # Current scene
alttester scene --list # All loaded scenes
alttester scene --load MainMenu # Load a scene
game-state#
Gets the full game object hierarchy for the current scene.
Parameters
Name |
Required |
Description |
|---|---|---|
|
No |
Limit the hierarchy to objects under this root object path. |
|
No |
File path to save the game state to. If omitted, saved to |
Returns
Game state snapshot containing the full object hierarchy, scene info, and screen positions.
Examples
alttester game-state
alttester game-state --root Canvas
alttester game-state --output my-state.json
snapshot#
Captures and saves a game state snapshot, or reads back a previously saved one.
Parameters
Name |
Required |
Description |
|---|---|---|
|
No |
Limit the snapshot to objects under this root object path (capture mode). |
|
No |
File path to save the snapshot to. If omitted, saved to |
|
No |
Read and print the latest snapshot instead of capturing a new one. Does not require a connected game. |
|
No |
Path to a specific snapshot file to read when using |
|
No |
When used with |
Returns
Path to the saved snapshot file (capture mode), or the rendered hierarchy / raw JSON (read-back mode).
Examples
alttester snapshot
alttester snapshot --root Canvas/Menu
alttester snapshot --output menu-snapshot.json
# Read back the latest snapshot (no game connection needed)
alttester snapshot --show
alttester snapshot --show --json
alttester snapshot --show --file path/to/snapshot.json
screen-size#
Gets the game’s screen resolution.
Parameters
No parameters.
Returns
Width and height of the screen in pixels.
Examples
alttester screen-size
get-property#
Reads a component property from an object.
Parameters
Name |
Required |
Description |
|---|---|---|
value |
Yes |
The object name or locator value. |
|
Yes |
The component type name. |
|
Yes |
The property name on the component. |
|
Yes |
The name of the assembly containing the component. |
|
No |
Locator strategy. The default value is: |
|
No |
Maximum depth for nested property traversal. The default value is: |
Returns
The value of the requested property.
Examples
alttester get-property Player \
--component PlayerController \
--property Health \
--assembly Assembly-CSharp
set-property#
Sets a component property on an object.
Parameters
Name |
Required |
Description |
|---|---|---|
value |
Yes |
The object name or locator value. |
|
Yes |
The component type name. |
|
Yes |
The property name on the component. |
|
Yes |
The name of the assembly containing the component. |
|
Yes |
The new value to assign to the property. |
|
No |
Locator strategy. The default value is: |
Returns
Confirmation.
Examples
alttester set-property Player \
--component PlayerController \
--property Health \
--assembly Assembly-CSharp \
--set-value 100
wait-for-property#
Waits until a component property reaches an expected value.
Parameters
Name |
Required |
Description |
|---|---|---|
value |
Yes |
The object name or locator value. |
|
Yes |
The component type name. |
|
Yes |
The property name on the component. |
|
Yes |
The name of the assembly containing the component. |
|
Yes |
The expected value to wait for. |
|
No |
Locator strategy. The default value is: |
|
No |
How long to wait before failing, in seconds. The default value is: |
|
No |
How often to poll the property, in seconds. The default value is: |
Returns
The matched property value.
Examples
alttester wait-for-property Player \
--component PlayerController \
--property Health \
--assembly Assembly-CSharp \
--expected 0 \
--timeout 30
get-time-scale#
Gets the current game time scale.
Parameters
No parameters.
Returns
The current time scale as a float.
Examples
alttester get-time-scale
set-time-scale#
Sets the game time scale. Useful for speeding up or pausing gameplay during tests.
Parameters
Name |
Required |
Description |
|---|---|---|
value |
Yes |
The time scale to set. Use |
Returns
Confirmation.
Examples
alttester set-time-scale 0 # Pause
alttester set-time-scale 0.5 # Half speed
alttester set-time-scale 1 # Normal
alttester set-time-scale 2 # Double speed
screenshot#
Takes a screenshot of the game.
Parameters
Name |
Required |
Description |
|---|---|---|
|
No |
File path for the saved PNG. The default value is: |
Returns
Path to the saved PNG screenshot file.
Examples
alttester screenshot
alttester screenshot --path my-screenshot.png