Search Results for

    Show / Hide Table of Contents

    Class Prefab

    Json asset that stores the collection of scene objects including actors and scripts. In general, it can serve as any grouping of scene objects (for example a level) or be used as a form of a template instantiated and reused throughout the scene.

    Inheritance
    System.Object
    Object
    Asset
    JsonAssetBase
    Prefab
    Inherited Members
    JsonAssetBase.Init(String, String)
    JsonAssetBase.GetReferences(String, Guid[])
    JsonAssetBase.DataTypeName
    JsonAssetBase.DataEngineBuild
    JsonAssetBase.Data
    Asset.Reload()
    Asset.WaitForLoaded(Double)
    Asset.GetReferences()
    Asset.Save(String)
    Asset.ToString()
    Asset.ReferencesCount
    Asset.Path
    Asset.IsLoaded
    Asset.LastLoadFailed
    Asset.IsVirtual
    Asset.ShouldDeleteFileOnUnload
    Asset.MemoryUsage
    Object.__unmanagedPtr
    Object.__internalId
    Object.Finalize()
    Object.As<T>()
    Object.NewValue(Type)
    Object.New(String)
    Object.Find<T>(Guid, Boolean)
    Object.Find(Guid, Type, Boolean)
    Object.TryFind<T>(Guid)
    Object.TryFind(Guid, Type)
    Object.Destroy(Object, Single)
    Object.DestroyNow(Object)
    Object.Destroy<T>(T, Single)
    Object.Equals(Object)
    Object.GetUnmanagedPtr(Object)
    Object.GetUnmanagedInterface(Object, Type)
    Object.FromUnmanagedPtr(IntPtr)
    Object.MapObjectID(Guid)
    Object.RemapObjectID(Guid)
    Object.GetHashCode()
    Object.ID
    Object.TypeName
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public class Prefab : JsonAssetBase

    Constructors

    Prefab()

    Initializes a new instance of the Prefab.

    Declaration
    public Prefab()

    Methods

    GetDefaultInstance()

    Requests the default prefab object instance. Deserializes the prefab objects from the asset. Skips if already done.

    Declaration
    [Unmanaged]
    public Actor GetDefaultInstance()
    Returns
    Actor

    The root of the prefab object loaded from the prefab. Contains the default values. It's not added to gameplay but deserialized with postLoad and init event fired.

    GetDefaultInstance(ref Guid)

    Requests the default prefab object instance. Deserializes the prefab objects from the asset. Skips if already done.

    Declaration
    [Unmanaged]
    public SceneObject GetDefaultInstance(ref Guid objectId)
    Parameters
    System.Guid objectId

    The ID of the object to get from prefab default object. It can be one of the child-actors or any script that exists in the prefab. Methods returns root if id is empty.

    Returns
    SceneObject

    The object of the prefab loaded from the prefab. Contains the default values. It's not added to gameplay but deserialized with postLoad and init event fired.

    GetNestedObject(ref Guid, out Guid, out Guid)

    Gets the reference to the other nested prefab for a specific prefab object.

    Declaration
    [Unmanaged]
    public bool GetNestedObject(ref Guid objectId, out Guid outPrefabId, out Guid outObjectId)
    Parameters
    System.Guid objectId

    The ID of the object in this prefab.

    System.Guid outPrefabId

    Result ID of the prefab asset referenced by the given object.

    System.Guid outObjectId

    Result ID of the prefab object referenced by the given object.

    Returns
    System.Boolean

    True if got valid reference, otherwise false.

    Resave()

    Resaves the prefab asset to the file by serializing default instance in the latest format and defaults.

    Declaration
    [Unmanaged]
    public bool Resave()
    Returns
    System.Boolean

    True if failed, otherwise false.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.DeepClone<T>(T)
    Extensions.RawClone<T>(T)

    See Also

    JsonAssetBase
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat