public class Sandbox.PrefabFile : Sandbox.GameResource
A GameObject which is saved to a file.
Related Guides
Broader workflow and conceptual references connected to this API.
The mount system is extensible - anyone can write a mount to add support for a new game or engine and contribute it to s&box via pull request. A mount detects a game's install directory via Steam, scans its files, and converts assets into s&box compatible assets, all at runtime.
You can implement the ISceneMetadata interface in any Component that has data you'd like saved to Metadata. Metadata is data that can be accessed without needing to load a Scene or clone a Prefab (accessed via either the SceneFile or PrefabFile)
A prefab is a GameObject that can be used in multiple places. They're usually used to contain an object that is used across multiple scenes, or needs to be instantiated at runtime.
Constructors
Showing 1 constructors
public PrefabFile()
No results match this filter.
Methods
Showing 7 methods
protected virtual Sandbox.Bitmap CreateAssetTypeIcon(int width, int height)
public string GetMetadata(string title, string defaultValue = null)
Read metadata saved using a ISceneMetadata based component, such as SceneInformation
Parameters
defaultValue: Default: null
public Sandbox.PrefabScene GetScene()
Get the actual scene scene
public static Sandbox.PrefabFile Load(string path)
Load a prefab by file path. Also handles mount:// paths
protected virtual void OnDestroy()
protected virtual void PostLoad()
protected virtual void PostReload()
No results match this filter.
Properties
Showing 8 properties
protected virtual object Sandbox.PrefabFile.ActionGraphTarget { get; set; }
protected virtual System.Type Sandbox.PrefabFile.ActionGraphTargetType { get; set; }
public bool Sandbox.PrefabFile.DontBreakAsTemplate { get; set; }
If true then the prefab will not be broken when created as a template
public string Sandbox.PrefabFile.MenuIcon { get; set; }
Icon to show to the left of the option in the menu
public string Sandbox.PrefabFile.MenuPath { get; set; }
If ShowInMenu is true, this is the path in the menu for this prefab
public virtual int Sandbox.PrefabFile.ResourceVersion { get; set; }
public System.Text.Json.Nodes.JsonObject Sandbox.PrefabFile.RootObject { get; set; }
Contains the original JSON read from File.
public bool Sandbox.PrefabFile.ShowInMenu { get; set; }
If true then we'll show this in the right click menu, so people can create it
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.PrefabFile |