PrefabFileclass

A GameObject which is saved to a file.

objectGameResourcePrefabFile
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public class Sandbox.PrefabFile : Sandbox.GameResource

Constructors1

Showing 1 constructors

Methods7

Showing 7 methods

protected virtual Sandbox.Bitmap CreateAssetTypeIcon(int width, int height)PROTECTEDVIRTUAL

ParameterTypeDescription
widthint
heightint
Returns:Bitmap

public string GetMetadata(string title, string defaultValue = null)PUBLIC

Read metadata saved using a ISceneMetadata based component, such as SceneInformation

ParameterTypeDescription
titlestring
defaultValue = nullstring
Returns:string

public static Sandbox.PrefabFile Load(string path)PUBLICSTATIC

Load a prefab by file path. Also handles mount:// paths

ParameterTypeDescription
pathstring
Returns:PrefabFile

protected virtual void OnDestroy()PROTECTEDVIRTUALLIFECYCLE

Returns:void

protected virtual void PostLoad()PROTECTEDVIRTUAL

Returns:void

protected virtual void PostReload()PROTECTEDVIRTUAL

Returns:void

Properties8

Showing 8 properties

protected virtual object Sandbox.PrefabFile.ActionGraphTarget { get; set; }PROTECTEDVIRTUALGETSET

Returns:object

protected virtual System.Type Sandbox.PrefabFile.ActionGraphTargetType { get; set; }PROTECTEDVIRTUALGETSET

Returns:Type

public bool Sandbox.PrefabFile.DontBreakAsTemplate { get; set; }PUBLICGETSET

If true then the prefab will not be broken when created as a template

Returns:bool

public virtual int Sandbox.PrefabFile.ResourceVersion { get; set; }PUBLICVIRTUALGETSET

Returns:int

public System.Text.Json.Nodes.JsonObject Sandbox.PrefabFile.RootObject { get; set; }PUBLICGETSET

Contains the original JSON read from File.

Returns:JsonObject

public bool Sandbox.PrefabFile.ShowInMenu { get; set; }PUBLICGETSET

If true then we'll show this in the right click menu, so people can create it

Returns:bool

On this page