logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityRailDriver

    Optional auto-advance component that drives RailProgress forward each frame by calling AdvanceProgress(RailId, float).
    Attach alongside UnityRailFollowerView or use independently.

    Inheritance
    object
    UnityRailDriver
    Implements
    IFoundationSettings
    Namespace: Serenity.GameRail.Infrastructure.Drivers
    Assembly: Serenity.UnityGameRail.Infrastructure.dll
    Syntax
    public class UnityRailDriver : MonoBehaviour, IFoundationSettings
    Remarks

    Intentionally Unity-only: a scene-authored MonoBehaviour driving progress via MonoBehaviour.Update and UnityEngine.Time.deltaTime. The Business contract (IGameRailService, RailProgress) is already engine-agnostic; this is just the per-frame "someone has to call AdvanceProgress" driver, re-authored per engine against that engine's own update loop.

    Constructors

    UnityRailDriver()

    Declaration
    public UnityRailDriver()

    Properties

    AutoDrive

    Declaration
    public bool AutoDrive { get; set; }
    Property Value
    Type Description
    bool

    EndMode

    Declaration
    public UnityRailDriver.EndBehaviour EndMode { get; set; }
    Property Value
    Type Description
    UnityRailDriver.EndBehaviour

    Guid

    Declaration
    public string Guid { get; set; }
    Property Value
    Type Description
    string

    Id

    Declaration
    public string Id { get; set; }
    Property Value
    Type Description
    string

    IsBound

    Declaration
    public bool IsBound { get; }
    Property Value
    Type Description
    bool

    RailIdValue

    Declaration
    public string RailIdValue { get; }
    Property Value
    Type Description
    string

    Speed

    Declaration
    public float Speed { get; set; }
    Property Value
    Type Description
    float

    Methods

    Bind(IGameRailService)

    Injects the rail service dependency.

    Declaration
    public void Bind(IGameRailService railService)
    Parameters
    Type Name Description
    IGameRailService railService

    BindRail(IGameRailService, string)

    Sets Serenity.GameRail.Infrastructure.Drivers.UnityRailDriver._railId and injects the rail service dependency in one call. Additive convenience for callers that need to (re)assign the rail identity at bind time — e.g. per-instance rails for pooled NPCs — without reaching for reflection to set the otherwise-private Serenity.GameRail.Infrastructure.Drivers.UnityRailDriver._railId field.

    Declaration
    public void BindRail(IGameRailService railService, string railId)
    Parameters
    Type Name Description
    IGameRailService railService

    The rail service to bind to.

    string railId

    The rail identity this driver should advance.

    Implements

    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved