Class SimulationSceneModule
Maintains a preview scene that the MARS Environment Manager uses to hold the environment objects and simulation query objects.
Namespace: Unity.MARS
Syntax
public class SimulationSceneModule : IModuleDependency<MARSSceneModule>, IModuleBehaviorCallbacks, IModule
Properties
ContentRoot
Root game object in the Content Scene.
Declaration
public GameObject ContentRoot { get; }
Property Value
Type | Description |
---|---|
GameObject |
ContentScene
The preview scene being used by the Simulation View to render simulated content objects.
Declaration
public Scene ContentScene { get; }
Property Value
Type | Description |
---|---|
Scene |
EnvironmentRoot
Root game object in the Environment Scene.
Declaration
public GameObject EnvironmentRoot { get; }
Property Value
Type | Description |
---|---|
GameObject |
EnvironmentScene
The preview scene being used by the Simulation View to render the simulated environment.
Declaration
public Scene EnvironmentScene { get; }
Property Value
Type | Description |
---|---|
Scene |
instance
Declaration
public static SimulationSceneModule instance { get; }
Property Value
Type | Description |
---|---|
SimulationSceneModule |
isAssemblyReloading
Declaration
public static bool isAssemblyReloading { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsSimulationReady
Is the simulation scene open and ready to be used.
Declaration
public bool IsSimulationReady { get; }
Property Value
Type | Description |
---|---|
Boolean |
UsingSimulation
Are there any simulation scene users.
Declaration
public static bool UsingSimulation { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
AddContentGameObject(GameObject, Boolean)
Moves a GameObject to the simulated content scene
Declaration
public void AddContentGameObject(GameObject go, bool keepAtRoot = false)
Parameters
Type | Name | Description |
---|---|---|
GameObject | go | The GameObject to move |
Boolean | keepAtRoot | Will keep the object at the root level of the simulated content scene otherwise it will be added the simulated content scene root object. |
AddEnvironmentGameObject(GameObject, Boolean)
Moves a GameObject to the simulated Environment scene
Declaration
public void AddEnvironmentGameObject(GameObject go, bool keepAtRoot = false)
Parameters
Type | Name | Description |
---|---|---|
GameObject | go | The GameObject to move |
Boolean | keepAtRoot | Will keep the object at the root level of the simulated environment scene otherwise it will be added the simulated environment scene root object. |
AssignCameraToSimulation(Camera)
Assigns a camera to a simulation with proper settings to render that view.
Declaration
public void AssignCameraToSimulation(Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | Camera to render a simulation scene |
CloseSimulation()
Closes the current simulation scene without changing if any objects are using the simulation scene
Declaration
public void CloseSimulation()
ConnectDependency(MARSSceneModule)
Declaration
public void ConnectDependency(MARSSceneModule dependency)
Parameters
Type | Name | Description |
---|---|---|
MARSSceneModule | dependency |
Implements
ContainsSimulationUser(ScriptableObject)
Is the Scriptable Object assigned as a user of the Simulation Scene
Declaration
public static bool ContainsSimulationUser(ScriptableObject user)
Parameters
Type | Name | Description |
---|---|---|
ScriptableObject | user | The object to check if using |
Returns
Type | Description |
---|---|
Boolean | True if the object is using the simulation scene |
IsCameraAssignedToSimulationScene(Camera)
Checks whether the camera is assigned to the simulation.
Declaration
public bool IsCameraAssignedToSimulationScene(Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | Camera to check if is assigned to the simulation. |
Returns
Type | Description |
---|---|
Boolean |
|
LoadModule()
Declaration
public void LoadModule()
Implements
OnBehaviorAwake()
Declaration
public void OnBehaviorAwake()
Implements
OnBehaviorDestroy()
Declaration
public void OnBehaviorDestroy()
Implements
OnBehaviorDisable()
Declaration
public void OnBehaviorDisable()
Implements
OnBehaviorEnable()
Declaration
public void OnBehaviorEnable()
Implements
OnBehaviorStart()
Declaration
public void OnBehaviorStart()
Implements
OnBehaviorUpdate()
Declaration
public void OnBehaviorUpdate()
Implements
RegisterSimulationUser(ScriptableObject)
Adds an object to the simulation scene users and opens the simulation scene if it is not already open
Declaration
public void RegisterSimulationUser(ScriptableObject user)
Parameters
Type | Name | Description |
---|---|---|
ScriptableObject | user | The object using the simulation scene |
RemoveCameraFromSimulation(Camera)
Camera to be removed from rendering a simulation.
Declaration
public void RemoveCameraFromSimulation(Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | Camera to stop rendering the simulation scene |
UnloadModule()
Declaration
public void UnloadModule()
Implements
UnregisterSimulationUser(ScriptableObject)
Removes an object from the simulation scene users. If there are no users after this removal then the simulation scene is closed.
Declaration
public void UnregisterSimulationUser(ScriptableObject user)
Parameters
Type | Name | Description |
---|---|---|
ScriptableObject | user | The object no longer using the simulation scene |
Events
SimulationSceneClosing
Callback for when a simulation scene is closing.
Declaration
public static event Action SimulationSceneClosing
Event Type
Type | Description |
---|---|
Action |
SimulationSceneOpened
Callback for when a simulation scene is opened.
Declaration
public static event Action SimulationSceneOpened
Event Type
Type | Description |
---|---|
Action |