Application

Reference for the global Application singleton, which manages engine state, timing, asset folders, hot‑reloading and the main loop.

Application

application is created when you call Ursina(). It orchestrates the update loop, time scaling, pause/resume, asset paths and development‑mode features like hot‑reloading.

Overview

The application singleton holds global engine settings and runtime state. It tracks whether the game is paused, scales the delta‑time for slow‑motion effects, manages folders for assets and scripts, and provides methods to pause, resume or quit the engine. When in development mode, it also wires up the hot‑reloader.

Fields

NameTypeDescription
.pausedboolTrue when the update loop is suspended.
.time_scalefloatMultiplier applied to unscaled delta‑time (time.dt_unscaled).
.calculate_dtboolIf True, compute time.dt each frame.
.sequenceslistActive animation or appear sequences.
.trace_entity_definitionboolIf True, record entity creation stack traces.
.package_folderPathRoot folder of the Ursina package.
.development_modeboolEnables editor UI, splash screen and hot‑reloading.
.window_typestrType of window used ('onscreen', 'offscreen', 'none').
.hot_reloaderHotReloader or NoneObject that watches files and reloads on change (dev mode only).
.scenes_folder, .scripts_folder, .fonts_folder, .compressed_textures_folder, .compressed_models_folderPathAsset subfolders for organized content.

Properties

PropertyDescription
.pausedGet/set pause state.
.time_scaleGet/set global time scale.
.development_modeGet/set whether development features are enabled.

Methods

MethodDescription
pause()Suspend the update loop (sets .paused = True).
resume()Resume updates (sets .paused = False).
quit()Stop the main loop and close the window.
load_settings(path=...)Execute a Python settings file to override defaults (window, input, etc.).

Example Usage

from ursina import Ursina, application

app = Ursina(development_mode=True)

# slow down time to half‑speed
application.time_scale = 0.5

# pause the game when 'p' is pressed
def input(key):
    if key == 'p':
        if application.paused:
            application.resume()
        else:
            application.pause()

# quit on escape
def update():
    if application.paused:
        print('Game is paused')

app.run()