Search Results for

    Show / Hide Table of Contents

    Class Prefab

    Class that represents a template.

    Inheritance
    object
    DisposableObject
    Prefab
    Implements
    ILoadable
    IDependencyObject
    Inherited Members
    DisposableObject.Disposed
    DisposableObject.Dispose()
    DisposableObject.Dispose(bool)
    Namespace: Evergine.Framework.Prefabs
    Assembly: Evergine.Framework.dll
    Syntax
    public class Prefab : DisposableObject, ILoadable, IDependencyObject

    Constructors

    Prefab(AssetsService, EntityItemModel, Dictionary<Guid, int>)

    Initializes a new instance of the Prefab class.

    Declaration
    public Prefab(AssetsService assetsService, EntityItemModel root, Dictionary<Guid, int> referenceCounter = null)
    Parameters
    Type Name Description
    AssetsService assetsService

    The asset service.

    EntityItemModel root

    The root entity.

    Dictionary<Guid, int> referenceCounter

    The reference counter for this prefab.

    Prefab(AssetsService, Func<Dictionary<Guid, int>, EntityItemModel>)

    Initializes a new instance of the Prefab class.

    Declaration
    public Prefab(AssetsService assetsService, Func<Dictionary<Guid, int>, EntityItemModel> rootGenerator)
    Parameters
    Type Name Description
    AssetsService assetsService

    The asset service.

    Func<Dictionary<Guid, int>, EntityItemModel> rootGenerator

    A function that generates the root entity.

    Properties

    Dependencies

    Gets the list of dependencies.

    Declaration
    public Lazy<List<IDependencyLink>> Dependencies { get; }
    Property Value
    Type Description
    Lazy<List<IDependencyLink>>

    EntityGenerated

    Gets a value indicating whether the entity has been generated.

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

    Id

    Gets or sets the asset ID.

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

    The asset path.

    RawEntity

    Gets the original prefab entity.

    Declaration
    public EntityItemModel RawEntity { get; }
    Property Value
    Type Description
    EntityItemModel

    ReaderVersion

    Gets the reader version.

    Declaration
    public Version ReaderVersion { get; }
    Property Value
    Type Description
    Version

    The reader version.

    ReferenceCounter

    Gets the reference count of the assets.

    Declaration
    public Dictionary<Guid, int> ReferenceCounter { get; }
    Property Value
    Type Description
    Dictionary<Guid, int>

    Methods

    CheckCycles(Guid)

    Checks the prefabs for cycles.

    Declaration
    public bool CheckCycles(Guid prefabId)
    Parameters
    Type Name Description
    Guid prefabId

    The ID of the prefab that we're checking.

    Returns
    Type Description
    bool

    True if there are cycles; false otherwise.

    Destroy()

    Destroys all resources of this instance.

    Declaration
    protected override void Destroy()
    Overrides
    DisposableObject.Destroy()

    Instantiate()

    Instantiates a prefab.

    Declaration
    public Entity Instantiate()
    Returns
    Type Description
    Entity

    The entity after instantiation.

    Invalidate(ILoadable)

    Invalidates this instance and raises the Invalidated event with the new ILoadable instance.

    Declaration
    public void Invalidate(ILoadable newInstance)
    Parameters
    Type Name Description
    ILoadable newInstance

    The new ILoadable instance.

    ReleaseUnusedMemory()

    Releases unused memory.

    Declaration
    public void ReleaseUnusedMemory()

    Events

    Invalidated

    Occurs when this instance is invalidated and all references must be reloaded.

    Declaration
    public event EventHandler<ILoadable> Invalidated
    Event Type
    Type Description
    EventHandler<ILoadable>

    Implements

    ILoadable
    IDependencyObject

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In this article
    Back to top
    Generated by DocFX