Class MARSEnvironmentManager
Module responsible for setting up and switching between simulation environments of different types.
Inheritance
Implements
Inherited Members
Namespace: UnityEditor.MARS.Simulation
Assembly: Unity.MARS.Editor.dll
Syntax
[ScriptableSettingsPath("Assets/MARS/Settings")]
[MovedFrom("Unity.MARS")]
public class MARSEnvironmentManager : EditorScriptableSettings<MARSEnvironmentManager>, IModuleDependency<SimulationRecordingManager>, IModuleDependency<QuerySimulationModule>, IModuleDependency<SimulationSceneModule>, IModuleDependency<MarsWorldScaleModule>, IModuleDependency<FunctionalityInjectionModule>, IModuleDependency<SimulatedObjectsManager>, IModuleDependency<SimulationVideoContextManager>, IModule, IProvidesDeviceSimulationSettings, IFunctionalityProvider
Fields
EnvironmentLabel
Asset label used to collect environment prefabs
Declaration
public const string EnvironmentLabel = "Environment"
Field Value
Type | Description |
---|---|
string |
Properties
CurrentLoadedPrefabInstanceEnvironment
The currently loaded synthetic environment mode prefab instance
Declaration
public GameObject CurrentLoadedPrefabInstanceEnvironment { get; }
Property Value
Type | Description |
---|---|
GameObject |
CurrentSyntheticEnvironmentIndex
Index of the currently active synthetic environment in the m_EnvironmentPrefabsPaths list
Declaration
public int CurrentSyntheticEnvironmentIndex { get; }
Property Value
Type | Description |
---|---|
int |
CustomModeSettings
The custom mode settings assigned to the environment manager
Declaration
public SimulationEnvironmentModeSettings CustomModeSettings { get; }
Property Value
Type | Description |
---|---|
SimulationEnvironmentModeSettings |
DefaultDeviceStartingPose
The default device starting pose for a synthetic environment
Declaration
public Pose DefaultDeviceStartingPose { get; }
Property Value
Type | Description |
---|---|
Pose |
DeviceStartingPose
The pose of the device when a simulation starts
Declaration
public Pose DeviceStartingPose { get; }
Property Value
Type | Description |
---|---|
Pose |
EnvironmentBounds
Bounds encapsulating the whole environment
Declaration
public Bounds EnvironmentBounds { get; }
Property Value
Type | Description |
---|---|
Bounds |
EnvironmentParent
The root object that environment objects are added to
Declaration
public GameObject EnvironmentParent { get; }
Property Value
Type | Description |
---|---|
GameObject |
EnvironmentSetup
Whether there is currently a simulation environment setup
Declaration
public bool EnvironmentSetup { get; }
Property Value
Type | Description |
---|---|
bool |
HasCustomModeSettings
Does the environment manager have a custom mode assigned
Declaration
public bool HasCustomModeSettings { get; }
Property Value
Type | Description |
---|---|
bool |
IsFramingEnabled
Is framing the simulation from a simulation view enabled in the current environment and mode
Declaration
public bool IsFramingEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
IsMovementEnabled
Is movement enabled in the current environment and mode
Declaration
public bool IsMovementEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
ModeTypes
Gui contents generated from the available EnvironmentMode
s
Declaration
public static GUIContent[] ModeTypes { get; }
Property Value
Type | Description |
---|---|
GUIContent[] |
SyntheticEnvironmentName
Name of the current synthetic environment prefab
Declaration
public string SyntheticEnvironmentName { get; }
Property Value
Type | Description |
---|---|
string |
SyntheticEnvironmentsExist
Checks whether any synthetic environment prefab have been found
Declaration
public bool SyntheticEnvironmentsExist { get; }
Property Value
Type | Description |
---|---|
bool |
VoxelSizeFromEnvironment
The voxel size of the PlaneExtractionSettings
in the current environment
Declaration
public float? VoxelSizeFromEnvironment { get; }
Property Value
Type | Description |
---|---|
float? |
Methods
ForceSetupNextEnvironment(bool)
Sets up the next environment of the current type without the option to save environment changes.
Declaration
public void ForceSetupNextEnvironment(bool forward)
Parameters
Type | Name | Description |
---|---|---|
bool | forward | Direction in which to cycle through environments |
SetEnvironmentInfo(MARSEnvironmentInfo)
Sets the environment info in the environment manager for the synthetic environment
Declaration
public void SetEnvironmentInfo(MARSEnvironmentInfo environmentInfo)
Parameters
Type | Name | Description |
---|---|---|
MARSEnvironmentInfo | environmentInfo | The new environment info to set in the manager |
TryFrameAllSimViewsOnEnvironment()
Try to frame all the simulation views on the synthetic environment with the synthetic environment info
Declaration
public void TryFrameAllSimViewsOnEnvironment()
TryFrameSimViewOnEnvironment(ISimulationView, bool)
Try to frame the simulation view on the current environment, if possible
Declaration
public Quaternion TryFrameSimViewOnEnvironment(ISimulationView simView, bool instant)
Parameters
Type | Name | Description |
---|---|---|
ISimulationView | simView | The simulation view which should be updated |
bool | instant | Whether to update the view instantly or with an animated transition |
Returns
Type | Description |
---|---|
Quaternion | The rotation of the simulation view camera once the view is framed |
TryFrameSimViewOnEnvironment(ISimulationView, bool, bool)
Try to frame the simulation view on the current environment, if possible
Declaration
[Obsolete("The rotateView parameter of TryFrameSimViewOnEnvironment is obsolete; Use the overload with two parameters")]
public Quaternion TryFrameSimViewOnEnvironment(ISimulationView simView, bool rotateView, bool instant)
Parameters
Type | Name | Description |
---|---|---|
ISimulationView | simView | The simulation view which should be updated |
bool | rotateView | Whether to rotate the view as well as translate it |
bool | instant | Whether to update the view instantly or with an animated transition |
Returns
Type | Description |
---|---|
Quaternion | The rotation of the simulation view camera once the view is framed |
TrySaveEnvironmentModificationsDialog(bool)
Brings up the save simulated environment dialog if there are changes that are not ignored due to properties that the simulation controls.
Declaration
public bool TrySaveEnvironmentModificationsDialog(bool cancelable = true)
Parameters
Type | Name | Description |
---|---|---|
bool | cancelable | Is the operation that caused the save dialog cancelable. |
Returns
Type | Description |
---|---|
bool | Returns true if the dialog was completed without canceling. |
TrySetupEnvironmentAndRestartSimulation(int)
Sets up the specified environment based on index in environment list of the current type and then triggers simulation restart.
Declaration
public bool TrySetupEnvironmentAndRestartSimulation(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Specified index of environment |
Returns
Type | Description |
---|---|
bool | If True, setup of the environment was not canceled. |
TrySetupNextEnvironmentAndRestartSimulation(bool)
Sets up the next environment of the current type and then triggers simulation restart after a save dialog if there are any saveable changes in the environment.
Declaration
public bool TrySetupNextEnvironmentAndRestartSimulation(bool forward)
Parameters
Type | Name | Description |
---|---|---|
bool | forward | Direction in which to cycle through environments |
Returns
Type | Description |
---|---|
bool | If True, setup of environment and restart was not canceled. |
UpdateSimulatedEnvironmentCandidates()
Update the Simulated Environments available in Synthetic Simulation
Declaration
public void UpdateSimulatedEnvironmentCandidates()
UpdateSimulationEnvironmentsMenuItem()
Update the Simulated Environments available in Synthetic Simulation
Declaration
[MenuItem("Window/MARS/Developer/Update Simulation Environments", priority = 2095)]
public static void UpdateSimulationEnvironmentsMenuItem()
Events
EnvironmentChanged
Event callback for when the simulated environment has changed
Declaration
public event Action EnvironmentChanged
Event Type
Type | Description |
---|---|
Action |
onEnvironmentSetup
Called when the simulated environment is setup and calls
EditorOnlyEvents.OnEnvironmentSetup
Declaration
public static event Action onEnvironmentSetup
Event Type
Type | Description |
---|---|
Action |