Class MixedRealitySceneSystem
The default implementation of the IMixedRealitySceneSystem Because so much of this service's functionality is editor-only, it has been split into a partial class. This part handles the runtime parts of the service.
Implements
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.SceneSystem
Assembly: cs.temp.dll.dll
Syntax
public class MixedRealitySceneSystem : BaseCoreSystem, IMixedRealitySceneSystem, IMixedRealityEventSystem, IMixedRealityService, IDisposable, IMixedRealityEventSource, IEqualityComparer, IMixedRealitySceneSystemEditor
Constructors
MixedRealitySceneSystem(IMixedRealityServiceRegistrar, MixedRealitySceneSystemProfile)
Constructor.
Declaration
public MixedRealitySceneSystem(IMixedRealityServiceRegistrar registrar, MixedRealitySceneSystemProfile profile)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityServiceRegistrar | registrar | The IMixedRealityServiceRegistrar instance that loaded the service. |
MixedRealitySceneSystemProfile | profile | The configuration profile for the service. |
MixedRealitySceneSystem(MixedRealitySceneSystemProfile)
Constructor.
Declaration
public MixedRealitySceneSystem(MixedRealitySceneSystemProfile profile)
Parameters
Type | Name | Description |
---|---|---|
MixedRealitySceneSystemProfile | profile | The configuration profile for the service. |
Properties
ActiveLightingScene
Name of the currently loaded lighting scene. If a transition is in progress, this reports the target lighting scene we're transitioning to.
Declaration
public string ActiveLightingScene { get; }
Property Value
Type | Description |
---|---|
String |
ContentSceneNames
An array of content scenes available to load / unload. Order in array matches build order. Useful if you want to present an ordered list of options, or if you want to track which scenes are loaded via IsContentLoaded.
Declaration
public string[] ContentSceneNames { get; }
Property Value
Type | Description |
---|---|
String[] |
LightingOperationInProgress
True if the scene system is transitioning from one lighting scene to another. Lighting operations will not impede other operations.
Declaration
public bool LightingOperationInProgress { get; }
Property Value
Type | Description |
---|---|
Boolean |
LightingOperationProgress
Progress of current lighting operation, from 0-1
Declaration
public float LightingOperationProgress { get; }
Property Value
Type | Description |
---|---|
Single |
Name
Optional Priority attribute if multiple services of the same type are required, enables targeting a service for action.
Declaration
public override string Name { get; protected set; }
Property Value
Type | Description |
---|---|
String |
Overrides
NextContentExists
Returns true if a content scene appears in build settings AFTER the latest loaded build index. Use to verify that LoadNextContent can be performed without wrapping.
Declaration
public bool NextContentExists { get; }
Property Value
Type | Description |
---|---|
Boolean |
OnContentLoaded
Declaration
public BaseEventSystem.Action<IEnumerable<string>> OnContentLoaded { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<IEnumerable<String>> |
OnContentUnloaded
Declaration
public BaseEventSystem.Action<IEnumerable<string>> OnContentUnloaded { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<IEnumerable<String>> |
OnLightingLoaded
Declaration
public BaseEventSystem.Action<string> OnLightingLoaded { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<String> |
OnLightingUnloaded
Declaration
public BaseEventSystem.Action<string> OnLightingUnloaded { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<String> |
OnSceneLoaded
Declaration
public BaseEventSystem.Action<string> OnSceneLoaded { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<String> |
OnSceneUnloaded
Declaration
public BaseEventSystem.Action<string> OnSceneUnloaded { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<String> |
OnWillLoadContent
Declaration
public BaseEventSystem.Action<IEnumerable<string>> OnWillLoadContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<IEnumerable<String>> |
OnWillLoadLighting
Declaration
public BaseEventSystem.Action<string> OnWillLoadLighting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<String> |
OnWillLoadScene
Declaration
public BaseEventSystem.Action<string> OnWillLoadScene { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<String> |
OnWillUnloadContent
Declaration
public BaseEventSystem.Action<IEnumerable<string>> OnWillUnloadContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<IEnumerable<String>> |
OnWillUnloadLighting
Declaration
public BaseEventSystem.Action<string> OnWillUnloadLighting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<String> |
OnWillUnloadScene
Declaration
public BaseEventSystem.Action<string> OnWillUnloadScene { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.MixedReality.Toolkit.BaseEventSystem.Action<String> |
PrevContentExists
Returns true if a content scene appears in build settings PRIOR to the latest loaded build index. Use to verify that LoadPrevContent can be performed without wrapping.
Declaration
public bool PrevContentExists { get; }
Property Value
Type | Description |
---|---|
Boolean |
SceneOperationInProgress
True if the scene system is loading or unloading content scenes. Manager and lighting scenes are ignored.
Declaration
public bool SceneOperationInProgress { get; }
Property Value
Type | Description |
---|---|
Boolean |
SceneOperationProgress
Progress of the current scene operation, from 0-1. A scene operation may include multiple concurrently loaded scenes.
Declaration
public float SceneOperationProgress { get; }
Property Value
Type | Description |
---|---|
Single |
SourceId
The unique source id of this event source.
Declaration
public uint SourceId { get; }
Property Value
Type | Description |
---|---|
UInt32 |
SourceName
The name of this event source.
Declaration
public string SourceName { get; }
Property Value
Type | Description |
---|---|
String |
WaitingToProceed
True when content has been loaded with an activation token and AllowSceneActivation has not been set to true. Useful for existing entities that shouldn't act until a newly loaded scene is actually activated.
Declaration
public bool WaitingToProceed { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Destroy()
Optional Destroy function to perform cleanup of the service before the Mixed Reality Toolkit is destroyed.
Declaration
public override void Destroy()
Overrides
Disable()
Optional Disable function to pause the service.
Declaration
public override void Disable()
Overrides
Enable()
Optional Enable function to enable / re-enable the service.
Declaration
public override void Enable()
Overrides
GetScene(String)
Returns a scene by name. Useful for processing events.
Declaration
public Scene GetScene(string sceneName)
Parameters
Type | Name | Description |
---|---|---|
String | sceneName |
Returns
Type | Description |
---|---|
Scene |
GetScenes(IEnumerable<String>)
Returns a set of scenes by name. Useful for processing events.
Declaration
public IEnumerable<Scene> GetScenes(IEnumerable<string> sceneNames)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<String> | sceneNames |
Returns
Type | Description |
---|---|
IEnumerable<Scene> |
Initialize()
The initialize function is used to setup the service once created. This method is called once all services have been registered in the Mixed Reality Toolkit.
Declaration
public override void Initialize()
Overrides
IsContentLoaded(String)
Returns true if a content scene is fully loaded.
Declaration
public bool IsContentLoaded(string sceneName)
Parameters
Type | Name | Description |
---|---|---|
String | sceneName |
Returns
Type | Description |
---|---|
Boolean |
LoadContent(IEnumerable<String>, LoadSceneMode, SceneActivationToken)
Async method to load the scenes by name. If a scene operation is in progress, no action will be taken.
Declaration
public Task LoadContent(IEnumerable<string> scenesToLoad, LoadSceneMode mode = null, SceneActivationToken activationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<String> | scenesToLoad | Names of content scenes to load. Invalid scenes will be ignored. |
LoadSceneMode | mode | Additive mode will load the content additively. Single mode will first unload all loaded content scenes first. |
SceneActivationToken | activationToken | Optional token for manual scene activation. Useful for loading screens and multiplayer. If not null, operation will wait until activationToken's AllowSceneActivation value is true before activating scene objects. |
Returns
Type | Description |
---|---|
Task | Task |
LoadContent(String, LoadSceneMode, SceneActivationToken)
Async method to load a single scene by name. If a scene operation is in progress, no action will be taken.
Declaration
public Task LoadContent(string sceneToLoad, LoadSceneMode mode = null, SceneActivationToken activationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | sceneToLoad | Name of content scene to load. Invalid scenes will be ignored. |
LoadSceneMode | mode | Additive mode will load the content additively. Single mode will first unload all loaded content scenes first. |
SceneActivationToken | activationToken | Optional token for manual scene activation. Useful for loading screens and multiplayer. If not null, operation will wait until activationToken's AllowSceneActivation value is true before activating scene objects. |
Returns
Type | Description |
---|---|
Task | Task |
LoadContentByTag(String, LoadSceneMode, SceneActivationToken)
Async method to load content scenes by tag. All scenes with the supplied tag will be loaded. If no scenes with this tag are found, no action will be taken. If a scene operation is in progress, no action will be taken.
Declaration
public Task LoadContentByTag(string tag, LoadSceneMode mode = null, SceneActivationToken activationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | tag | Scene tag. |
LoadSceneMode | mode | Additive mode will load the content additively. Single mode will first unload all loaded content scenes first. |
SceneActivationToken | activationToken | Optional token for manual scene activation. Useful for loading screens and multiplayer. If not null, operation will wait until activationToken's AllowSceneActivation value is true before activating scene objects. |
Returns
Type | Description |
---|---|
Task | Task |
LoadNextContent(Boolean, LoadSceneMode, SceneActivationToken)
Loads the next content scene according to build index. Uses the last-loaded content scene as previous build index. If no next content exists, and wrap is false, no action is taken. Use NextContentExists to verify that this operation is possible (if not using wrap).
Declaration
public Task LoadNextContent(bool wrap = false, LoadSceneMode mode = null, SceneActivationToken activationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | wrap | If true, if the current scene is the LAST content scene, the FIRST content scene will be loaded. |
LoadSceneMode | mode | Additive mode will load the content additively. Single mode will first unload all loaded content scenes first. |
SceneActivationToken | activationToken | Optional token for manual scene activation. Useful for loading screens and multiplayer. If not null, operation will wait until activationToken's AllowSceneActivation value is true before activating scene objects. |
Returns
Type | Description |
---|---|
Task | Task |
LoadPrevContent(Boolean, LoadSceneMode, SceneActivationToken)
Loads the previous content scene according to build index. Uses the loaded content scene with the smallest build index as previous build index. If no previous content exists, and wrap is false, no action is taken. Use PrevContentExists to verify that this operation is possible (if not using wrap).
Declaration
public Task LoadPrevContent(bool wrap = false, LoadSceneMode mode = null, SceneActivationToken activationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | wrap | If true, if the current scene is the FIRST content scene, the LAST content scene will be loaded. |
LoadSceneMode | mode | Additive mode will load the content additively. Single mode will first unload all loaded content scenes first. |
SceneActivationToken | activationToken | Optional token for manual scene activation. Useful for loading screens and multiplayer. If not null, operation will wait until activationToken's AllowSceneActivation value is true before activating scene objects. |
Returns
Type | Description |
---|---|
Task | Task |
SetLightingScene(String, LightingSceneTransitionType, Single)
Sets the current lighting scene. The lighting scene determines ambient light and skybox settings. It can optionally contain light objects. If the lighting scene is already loaded, no action will be taken. If a lighting scene transition is in progress, request will be queued and executed when the transition is complete.
Declaration
public void SetLightingScene(string newLightingSceneName, LightingSceneTransitionType transitionType = LightingSceneTransitionType.None, float transitionDuration = 1F)
Parameters
Type | Name | Description |
---|---|---|
String | newLightingSceneName | |
LightingSceneTransitionType | transitionType | The transition type to use. See LightingSceneTransitionType for information about each transition type. |
Single | transitionDuration | The duration of the transition (if not None). |
UnloadContent(IEnumerable<String>)
Async method to unload scenes by name. If a scene is not loaded, it will be ignored. If a scene operation is in progress, no action will be taken.
Declaration
public Task UnloadContent(IEnumerable<string> scenesToUnload)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<String> | scenesToUnload |
Returns
Type | Description |
---|---|
Task | Task |
UnloadContent(String)
Async method to unload a single scene by name. If the scene is not loaded, no action will be taken. If a scene operation is in progress, no action will be taken.
Declaration
public Task UnloadContent(string sceneToUnload)
Parameters
Type | Name | Description |
---|---|---|
String | sceneToUnload |
Returns
Type | Description |
---|---|
Task | Task |
UnloadContentByTag(String)
Async method to unload scenes by name. If a scene is not loaded, it will be ignored. If a scene operation is in progress, no action will be taken.
Declaration
public Task UnloadContentByTag(string tag)
Parameters
Type | Name | Description |
---|---|---|
String | tag | Scene tag |
Returns
Type | Description |
---|---|
Task | Task |
Update()
Optional Update function to perform per-frame updates of the service.
Declaration
public override void Update()