Search Results for

    Show / Hide Table of Contents

    Class Prefab

    Class that represents a prefab.

    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 assets service.

    EntityItemModel root

    The root entity.

    Dictionary<Guid, int> referenceCounter

    The reference counter of 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 assets service.

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

    A func that generates the root entity.

    Properties

    Dependencies

    Gets the dependency list.

    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 prefab original 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 counter 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()

    Destroy 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 already instantiated.

    Invalidate(ILoadable)

    Invalidates this instance and raise 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()

    Release unused memory.

    Declaration
    public void ReleaseUnusedMemory()

    Events

    Invalidated

    Occurs when this instance has been 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