logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityViewBrowserService

    Unity-specific implementation of view browser service for managing view navigation history.

    Inheritance
    object
    UnityViewBrowserService
    Implements
    IViewBrowserService
    IService
    IFoundationSettings
    Namespace: Serenity.ViewBrowser.Infrastructure.Services
    Assembly: Serenity.UnityViewBrowser.Infrastructure.dll
    Syntax
    public class UnityViewBrowserService : MonoBehaviour, IViewBrowserService, IService, IFoundationSettings

    Constructors

    UnityViewBrowserService()

    Declaration
    public UnityViewBrowserService()

    Fields

    Guid

    Declaration
    public string Guid
    Field Value
    Type Description
    string

    Id

    Declaration
    public string Id
    Field Value
    Type Description
    string

    MaxHistoryDepth

    Maximum number of entries retained in the navigation history. A value less than or equal to zero means unlimited — the default, preserving the append-only, uncapped behaviour documented for Push(ViewBrowserPushInput).

    Declaration
    public int MaxHistoryDepth
    Field Value
    Type Description
    int

    _history

    Declaration
    protected List<IViewBase> _history
    Field Value
    Type Description
    List<IViewBase>

    _logService

    Declaration
    protected ILogService _logService
    Field Value
    Type Description
    ILogService

    Properties

    LogService

    Declaration
    public ILogService LogService { get; set; }
    Property Value
    Type Description
    ILogService

    Methods

    ClearHistory()

    Clears all views from the navigation history.

    Declaration
    public virtual void ClearHistory()

    GetCurrentView()

    Gets the currently active view from the top of the history stack.

    Declaration
    public virtual IViewBase GetCurrentView()
    Returns
    Type Description
    IViewBase

    The current view if history is not empty, null otherwise.

    GetHistory()

    Gets the complete navigation history as a list of views.

    Declaration
    public virtual List<IViewBase> GetHistory()
    Returns
    Type Description
    List<IViewBase>

    A list containing all views in the navigation history.

    GoBack()

    Navigates back to the previous view in the history stack.

    Declaration
    public virtual IViewBase GoBack()
    Returns
    Type Description
    IViewBase

    The view that was navigated back to.

    Exceptions
    Type Condition
    Exception

    Thrown when there are no views to go back to.

    Push(ViewBrowserPushInput)

    Pushes a new view onto the navigation history stack.

    Declaration
    public virtual IViewBase Push(ViewBrowserPushInput input)
    Parameters
    Type Name Description
    ViewBrowserPushInput input

    The input data containing the view to push onto the stack.

    Returns
    Type Description
    IViewBase

    The view that was pushed onto the stack.

    TryGetCurrentView(out IViewBase)

    Gets the currently active view without throwing when the history is empty.

    Declaration
    public virtual bool TryGetCurrentView(out IViewBase view)
    Parameters
    Type Name Description
    IViewBase view

    The current active view, or null when the history is empty.

    Returns
    Type Description
    bool

    true when a current view exists; false when the history is empty.

    TryGoBack(out IViewBase)

    Navigates back to the previous view without throwing when the history is empty.

    Declaration
    public virtual bool TryGoBack(out IViewBase view)
    Parameters
    Type Name Description
    IViewBase view

    The view navigated back to, or null when the history was empty.

    Returns
    Type Description
    bool

    true when a view was popped; false when the history was empty.

    Implements

    IViewBrowserService
    IService
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved