logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityViewElement

    Unity-specific implementation of IFoundationViewElement that wraps GameObject functionality.
    Provides a bridge between Unity GameObjects and the foundation's view element abstraction, supporting initialization, activation control, and object access.

    Inheritance
    object
    UnityViewElement
    Implements
    IFoundationViewElement
    Namespace: Serenity.InterfaceAdapters.Entities
    Assembly: Serenity.UnityGlobal.InterfaceAdapters.dll
    Syntax
    public class UnityViewElement : MonoBehaviour, IFoundationViewElement

    Constructors

    UnityViewElement(object, ILogService)

    Initializes a new instance of UnityViewElement with the specified view element and log service.

    Declaration
    public UnityViewElement(object viewElement, ILogService logService)
    Parameters
    Type Name Description
    object viewElement

    The Unity GameObject to wrap

    ILogService logService

    Service for logging operations

    Fields

    _foundationViewElementFactory

    Declaration
    protected IFoundationViewElementFactory _foundationViewElementFactory
    Field Value
    Type Description
    IFoundationViewElementFactory

    Factory for creating foundation view elements.

    _logService

    Declaration
    protected ILogService _logService
    Field Value
    Type Description
    ILogService

    Service for logging operations.

    _viewElement

    Declaration
    protected object _viewElement
    Field Value
    Type Description
    object

    The underlying view element, expected to be a GameObject.

    Methods

    GetGameObject()

    Gets the underlying GameObject instance.

    Declaration
    public GameObject GetGameObject()
    Returns
    Type Description
    GameObject

    The wrapped GameObject

    GetViewElement()

    Gets the underlying view element object.

    Declaration
    public object GetViewElement()
    Returns
    Type Description
    object

    The wrapped view element (GameObject)

    Initialize(object)

    Initializes the view element with a new GameObject.

    Declaration
    public void Initialize(object viewElement)
    Parameters
    Type Name Description
    object viewElement

    Must be a GameObject instance

    Exceptions
    Type Condition
    ArgumentException

    Thrown when viewElement is not a GameObject

    SetActive(bool)

    Sets the active state of the underlying GameObject.

    Declaration
    public void SetActive(bool active)
    Parameters
    Type Name Description
    bool active

    True to activate the GameObject, false to deactivate it

    Implements

    IFoundationViewElement
    In this article
    © 2026 Serenity. All Rights Reserved