Search Results for

    Show / Hide Table of Contents

    Class Engine

    The main engine class.

    Inheritance
    System.Object
    Engine
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public static class Engine : Object

    Properties

    CommandLine

    Gets the application command line arguments.

    Declaration
    [Unmanaged]
    public static string CommandLine { get; }
    Property Value
    System.String

    FatalError

    The current state of the fatal error. Set to None if no error occurred yet.

    Declaration
    [Unmanaged]
    public static FatalErrorType FatalError { get; }
    Property Value
    FatalErrorType

    FrameCount

    Gets the current frame (drawing) count since the start of the game.

    Declaration
    [Unmanaged]
    public static ulong FrameCount { get; }
    Property Value
    System.UInt64

    FramesPerSecond

    Gets the amount of frames rendered during last second known as Frames Per Second. User scripts updates or fixed updates for physics may run at a different frequency than scene rendering. Use this property to get an accurate amount of frames rendered during the last second.

    Declaration
    [Unmanaged]
    public static int FramesPerSecond { get; }
    Property Value
    System.Int32

    HasFocus

    True if app has focus (one of the windows is being focused).

    Declaration
    [Unmanaged]
    public static bool HasFocus { get; }
    Property Value
    System.Boolean

    HasGameViewportFocus

    Checks whenever the game viewport is focused by the user (eg. can receive input).

    Declaration
    [Unmanaged]
    public static bool HasGameViewportFocus { get; }
    Property Value
    System.Boolean

    IsEditor

    Returns true if the game is running in the Flax Editor; false if run from any deployment target. Use this property to perform Editor-related actions.

    Declaration
    [Unmanaged]
    public static bool IsEditor { get; }
    Property Value
    System.Boolean

    IsHeadless

    Returns true if engine is running without main window (aka headless mode).

    Declaration
    [Unmanaged]
    public static bool IsHeadless { get; }
    Property Value
    System.Boolean

    IsRequestingExit

    Flags set to true if engine needs to be closed (exit is pending). Use FatalError to determinate the exit reason (specific error or normal shutdown).

    Declaration
    [Unmanaged]
    public static bool IsRequestingExit { get; }
    Property Value
    System.Boolean

    StartupTime

    The engine start time (local time).

    Declaration
    [Unmanaged]
    public static DateTime StartupTime { get; }
    Property Value
    System.DateTime

    UpdateCount

    Gets the current update counter since the start of the game.

    Declaration
    [Unmanaged]
    public static ulong UpdateCount { get; }
    Property Value
    System.UInt64

    UpdateGraph

    Task graph for engine update.

    Declaration
    [Unmanaged]
    public static TaskGraph UpdateGraph { get; }
    Property Value
    TaskGraph

    Methods

    Exit(Int32, FatalErrorType)

    Exits the engine.

    Declaration
    [DebugCommand]
    [Unmanaged]
    public static void Exit(int exitCode = -1, FatalErrorType error)
    Parameters
    System.Int32 exitCode

    The exit code.

    FatalErrorType error

    The fatal error type (or None on graceful exit).

    FocusGameViewport()

    Brings focused to the game viewport (game can receive input).

    Declaration
    [Unmanaged]
    public static void FocusGameViewport()

    GetCustomSettings(String)

    Gets the custom game settings asset referenced by the given key.

    Declaration
    [Unmanaged]
    public static JsonAsset GetCustomSettings(string key)
    Parameters
    System.String key

    The settings key.

    Returns
    JsonAsset

    The returned asset. Returns null if key is invalid, cannot load asset or data is missing.

    RequestExit(Int32, FatalErrorType)

    Requests normal engine exit.

    Declaration
    [Unmanaged]
    public static void RequestExit(int exitCode = 0, FatalErrorType error)
    Parameters
    System.Int32 exitCode

    The exit code.

    FatalErrorType error

    The fatal error type (or None on graceful exit).

    Events

    ReportCrash

    The custom handler for engine crash handling and reporting. Can be used to override default message box with a custom one or send crash report to telemetry service. Args are: error message and context pointer (for stack-trace access).

    Declaration
    [Unmanaged]
    public static event Action<string, IntPtr> ReportCrash
    Event Type
    System.Action<System.String, System.IntPtr>

    RequestingExit

    Event called when the engine is requesting exit.

    Declaration
    [Unmanaged]
    public static event Action RequestingExit
    Event Type
    System.Action

    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat