Sceneclass

objectGameObjectScene
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public class Sandbox.Scene : Sandbox.GameObject

Constructors2

Showing 2 constructors

Methods34

Showing 34 methods

public System.IDisposable AddHook(Sandbox.GameObjectSystem.Stage stage, int order, System.Action action, string className, string description)PUBLIC

Call this method on this stage. This returns a disposable that will remove the hook when disposed.

ParameterTypeDescription
stageStage
orderint
actionAction
classNamestring
descriptionstring
Returns:IDisposable

public System.IDisposable BatchGroup()PUBLIC

Collects anything inside into a batch group. A batchgroup is used with GameObject and Components to make sure that their OnEnable/OnDisable and other callbacks are called in a deterministic order, and that they can find each other during creation. `Sandbox.GameObject.NetworkSpawn` calls will also be batched.

Returns:IDisposable

public void ClearUnsavedChanges()PUBLICOBSOLETE

Obsolete: This API member is obsolete.

Returns:void

public static Sandbox.Scene CreateEditorScene()PUBLICSTATIC

Returns:Scene

public Sandbox.GameObject CreateObject(bool enabled = True)PUBLIC

Create a GameObject on this scene. This doesn't require the scene to be the active scene.

ParameterTypeDescription
enabled = Truebool
Returns:GameObject

public virtual void Destroy()PUBLICVIRTUAL

Destroy this scene. After this you should never use it again.

Returns:void

public void EditorDraw()PUBLIC

Returns:void

public void EditorTick(float timeNow, float timeDelta)PUBLIC

ParameterTypeDescription
timeNowfloat
timeDeltafloat
Returns:void

protected virtual override void Finalize()PROTECTEDVIRTUALOVERRIDE

Returns:void

public System.Collections.Generic.IEnumerable`1<Sandbox.GameObject> FindAllWithTag(string tag)PUBLIC

Find objects with tag

ParameterTypeDescription
tagstring
Returns:IEnumerable<GameObject>

public System.Collections.Generic.IEnumerable`1<Sandbox.GameObject> FindAllWithTags(System.Collections.Generic.IEnumerable`1<string> tags)PUBLIC

ParameterTypeDescription
tagsIEnumerable<string>
Returns:IEnumerable<GameObject>

public void GameTick(double timeDelta = 0.1)PUBLIC

ParameterTypeDescription
timeDelta = 0.1double
Returns:void

public T Get()PUBLIC

Gets the first object found of this type. This could be a component or a GameObjectSystem, or other stuff in the future.

Returns:T

public bool IsBBoxVisibleToConnection(Sandbox.Connection target, BBox box)PUBLIC

Are these bounds visible to the specified `Sandbox.Connection`?

ParameterTypeDescription
targetConnection
boxBBox
Returns:bool

public bool IsPointVisibleToConnection(Sandbox.Connection target, Vector3 position)PUBLIC

Is a position visible to the specified `Sandbox.Connection`?

ParameterTypeDescription
targetConnection
positionVector3
Returns:bool

public bool LoadFromFile(string filename)PUBLIC

Load from the provided file name. This will not load the scene for other clients in a multiplayer session, you should instead use `Sandbox.Game.ChangeScene(Sandbox.SceneLoadOptions)` if you want to bring other clients.

ParameterTypeDescription
filenamestring
Returns:bool

public void ProcessDeletes()PUBLIC

Delete any GameObjects waiting to be deleted

Returns:void

public System.IDisposable Push()PUBLIC

Push this scene as the active scene, for a scope

Returns:IDisposable

public virtual void RunEvent(System.Action`1<T> action, Sandbox.FindMode find = 69)PUBLICVIRTUAL

ParameterTypeDescription
actionAction<T>
find = 69FindMode
Returns:void

public System.Text.Json.Nodes.JsonObject SerializeProperties()PUBLIC

Returns:JsonObject

public void StartLoading()PUBLIC

Returns:void

Properties29

Showing 29 properties

public static System.Collections.Generic.IEnumerable`1<Sandbox.Scene> Sandbox.Scene.All { get; set; }PUBLICSTATICGETSET

All active non-editor scenes.

Returns:IEnumerable<Scene>

public string Sandbox.Scene.Description { get; set; }PUBLICGETSETOBSOLETE

Obsolete: please use the SceneInformation component

Returns:string

public Sandbox.Scene.ISceneEditorSession Sandbox.Scene.Editor { get; set; }PUBLICGETSET

Allows access to the scene's editor session from the game. This will be null if there is no editor session active on this scene.

public float Sandbox.Scene.FixedDelta { get; set; }PUBLICGETSET

Returns:float

public float Sandbox.Scene.FixedUpdateFrequency { get; set; }PUBLICGETSETFIXED TICKOBSOLETE

Obsolete: Moved to Sandbox.ProjectSettings.PhysicsSettings

Returns:float

public bool Sandbox.Scene.HasUnsavedChanges { get; set; }PUBLICGETSETOBSOLETE

Obsolete: Use Scene.Editor.HasUnsavedChanges

Returns:bool

public bool Sandbox.Scene.IsEditor { get; set; }PUBLICGETSET

Returns:bool

public bool Sandbox.Scene.IsFixedUpdate { get; set; }PUBLICGETSETFIXED TICK

Returns:bool

public bool Sandbox.Scene.IsLoading { get; set; }PUBLICGETSET

Return true if we're in an initial loading phase

Returns:bool

public virtual bool Sandbox.Scene.IsValid { get; set; }PUBLICVIRTUALGETSET

Returns true if this scene has not been destroyed

Returns:bool

public int Sandbox.Scene.MaxFixedUpdates { get; set; }PUBLICGETSETFIXED TICKOBSOLETE

Obsolete: Moved to Sandbox.ProjectSettings.PhysicsSettings

Returns:int

public float Sandbox.Scene.NetworkFrequency { get; set; }PUBLICGETSETOBSOLETE

Obsolete: Moved to ProjectSettings.Networking.UpdateRate

Returns:float

public float Sandbox.Scene.NetworkRate { get; set; }PUBLICGETSET

One divided by ProjectSettings.Networking.UpdateRate.

Returns:float

public int Sandbox.Scene.PhysicsSubSteps { get; set; }PUBLICGETSETOBSOLETE

Obsolete: Moved to Sandbox.ProjectSettings.PhysicsSettings

Returns:int

public Sandbox.SceneWorld Sandbox.Scene.SceneWorld { get; set; }PUBLICGETSET

The scene world, holding this scene's renderables. Created on first access, so scenes that never render anything (like prefab caches or tests) never create one.

Returns:SceneWorld

public bool Sandbox.Scene.ThreadedAnimation { get; set; }PUBLICGETSETOBSOLETE

Obsolete: Unused. Animation is always threaded.

Returns:bool

public float Sandbox.Scene.TimeScale { get; set; }PUBLICGETSET

Returns:float

public string Sandbox.Scene.Title { get; set; }PUBLICGETSETOBSOLETE

Obsolete: please use the SceneInformation component

Returns:string

public bool Sandbox.Scene.UseFixedUpdate { get; set; }PUBLICGETSETFIXED TICKOBSOLETE

Obsolete: Moved to Sandbox.ProjectSettings.PhysicsSettings

Returns:bool

public Sandbox.Volumes.VolumeSystem Sandbox.Scene.Volumes { get; set; }PUBLICGETSET

Allows quickly finding components that have a volume

Returns:VolumeSystem

public bool Sandbox.Scene.WantsSystemScene { get; set; }PUBLICGETSET

If true we'll additive load the system scene when this scene is loaded. Defaults to true. You might want to disable this for specific scenes, like menu scenes etc.

Returns:bool

On this page

Constructorspublic Scene()protected Scene(System.Boolean isEditor)Methodspublic System.IDisposable AddHook(Sandbox.GameObjectSystem.Stage stage, System.Int32 order, System.Action action, System.String className, System.String description)public System.IDisposable BatchGroup()public System.Void ClearUnsavedChanges()public static Sandbox.Scene CreateEditorScene()public Sandbox.GameObject CreateObject(System.Boolean enabled = True)public virtual System.Void Deserialize(System.Text.Json.Nodes.JsonObject node, Sandbox.GameObject.DeserializeOptions option)public virtual System.Void Destroy()public System.Void EditorDraw()public System.Void EditorTick(System.Single timeNow, System.Single timeDelta)protected virtual override System.Void Finalize()public System.Collections.Generic.IEnumerable`1<Sandbox.GameObject> FindAllWithTag(System.String tag)public System.Collections.Generic.IEnumerable`1<Sandbox.GameObject> FindAllWithTags(System.Collections.Generic.IEnumerable`1<System.String> tags)public System.Collections.Generic.IEnumerable`1<Sandbox.GameObject> FindInPhysics(BBox box)public System.Collections.Generic.IEnumerable`1<Sandbox.GameObject> FindInPhysics(Sandbox.Frustum frustum)public System.Collections.Generic.IEnumerable`1<Sandbox.GameObject> FindInPhysics(Sandbox.Sphere sphere)public System.Void GameTick(System.Double timeDelta = 0.1)public T Get()public System.Collections.Generic.IEnumerable`1<T> GetAll()public System.Void GetAll(System.Collections.Generic.List`1<T> target)public System.Collections.Generic.IEnumerable`1<Sandbox.Component> GetAllComponents(System.Type type)public System.Collections.Generic.IEnumerable`1<T> GetAllComponents()public T GetSystem()public System.Void GetSystem(T val)public System.Boolean IsBBoxVisibleToConnection(Sandbox.Connection target, BBox box)public System.Boolean IsPointVisibleToConnection(Sandbox.Connection target, Vector3 position)public virtual System.Boolean Load(Sandbox.GameResource resource)public System.Boolean Load(Sandbox.SceneLoadOptions options)public System.Boolean LoadFromFile(System.String filename)public System.Void ProcessDeletes()public System.IDisposable Push()public virtual System.Void RunEvent(System.Action`1<T> action, Sandbox.FindMode find = 69)public virtual System.Text.Json.Nodes.JsonObject Serialize(Sandbox.GameObject.SerializeOptions options = null)public System.Text.Json.Nodes.JsonObject SerializeProperties()public System.Void StartLoading()Propertiespublic static System.Collections.Generic.IEnumerable`1<Sandbox.Scene> Sandbox.Scene.All { get; set; }public Sandbox.CameraComponent Sandbox.Scene.Camera { get; set; }public Sandbox.SceneWorld Sandbox.Scene.DebugSceneWorld { get; set; }public System.String Sandbox.Scene.Description { get; set; }public Sandbox.GameObjectDirectory Sandbox.Scene.Directory { get; set; }public Sandbox.Scene.ISceneEditorSession Sandbox.Scene.Editor { get; set; }public System.Single Sandbox.Scene.FixedDelta { get; set; }public System.Single Sandbox.Scene.FixedUpdateFrequency { get; set; }public System.Boolean Sandbox.Scene.HasUnsavedChanges { get; set; }public System.Boolean Sandbox.Scene.IsEditor { get; set; }public System.Boolean Sandbox.Scene.IsFixedUpdate { get; set; }public System.Boolean Sandbox.Scene.IsLoading { get; set; }public virtual System.Boolean Sandbox.Scene.IsValid { get; set; }public System.Int32 Sandbox.Scene.MaxFixedUpdates { get; set; }public Sandbox.Navigation.NavMesh Sandbox.Scene.NavMesh { get; set; }public System.Single Sandbox.Scene.NetworkFrequency { get; set; }public System.Single Sandbox.Scene.NetworkRate { get; set; }public System.Int32 Sandbox.Scene.PhysicsSubSteps { get; set; }public Sandbox.PhysicsWorld Sandbox.Scene.PhysicsWorld { get; set; }public Sandbox.RenderAttributes Sandbox.Scene.RenderAttributes { get; set; }public Sandbox.SceneWorld Sandbox.Scene.SceneWorld { get; set; }public Sandbox.GameResource Sandbox.Scene.Source { get; set; }public System.Boolean Sandbox.Scene.ThreadedAnimation { get; set; }public System.Single Sandbox.Scene.TimeScale { get; set; }public System.String Sandbox.Scene.Title { get; set; }public Sandbox.SceneTrace Sandbox.Scene.Trace { get; set; }public System.Boolean Sandbox.Scene.UseFixedUpdate { get; set; }public Sandbox.Volumes.VolumeSystem Sandbox.Scene.Volumes { get; set; }public System.Boolean Sandbox.Scene.WantsSystemScene { get; set; }Metadata