Class MultipleScenes
Namespace: AppMana.Compatibility
Contains methods to mitigate issues when dealing with multiple scenes in Unity, such as handling screen space overlays, raycasters, input modules, main cameras, and preventing destruction of certain objects.
public class MultipleScenes
Inheritance
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
This addresses multiple scene usage in the plugin. Invoke these methods separately, or implement your own mitigations. These are invoked by default in
Methods
MultipleScenesMitigateDestructionOfCamera(Camera)
Prevents the specified camera from being destroyed across scene loads.
public static void MultipleScenesMitigateDestructionOfCamera(Camera target)
Parameters
target Camera
The Camera object to preserve.
MultipleScenesMitigateDestructionOfRemotePlayableConfiguration(RemotePlayableConfiguration)
Prevents the RemotePlayableConfiguration object from being destroyed across scene loads.
public static void MultipleScenesMitigateDestructionOfRemotePlayableConfiguration(RemotePlayableConfiguration remotePlayableConfiguration)
Parameters
remotePlayableConfiguration RemotePlayableConfiguration
The RemotePlayableConfiguration object to preserve.
MultipleScenesMitigateMultipleInputModules(RemotePlayableConfiguration)
Disables other input modules to prevent conflicts in a multi-scene setup, preserving only the input module from the original scene.
public static void MultipleScenesMitigateMultipleInputModules(RemotePlayableConfiguration remotePlayableConfiguration)
Parameters
remotePlayableConfiguration RemotePlayableConfiguration
The configuration object containing the active scene's input module.
Remarks
This method subscribes to the scene loaded observable to automatically adjust input modules when a new scene is loaded. New scenes will often duplicate this functionality incorrectly.
MultipleScenesMitigateMultipleMainCameras(RemotePlayableConfiguration)
Manages multiple main cameras in a multi-scene setup by adjusting their parent constraints to match a specified configuration.
public static void MultipleScenesMitigateMultipleMainCameras(RemotePlayableConfiguration remotePlayableConfiguration)
Parameters
remotePlayableConfiguration RemotePlayableConfiguration
The configuration object containing the reference camera.
Remarks
This method subscribes to the scene loaded observable to automatically manage main cameras when a new scene is loaded.
MultipleScenesMitigateRaycasters()
Fixes issues with raycasters in a multi-scene setup to ensure UI elements interact correctly.
public static void MultipleScenesMitigateRaycasters()
Remarks
This method subscribes to the scene loaded observable to automatically fix raycasters when a new scene is loaded. Raycasters should be "per user" by using the
MultipleScenesMitigateScreenSpaceOverlays(Camera)
Converts Canvas objects from ScreenSpaceOverlay to ScreenSpaceCamera to ensure they render correctly in a multi-scene setup.
public static void MultipleScenesMitigateScreenSpaceOverlays(Camera camera)
Parameters
camera Camera
The Camera to be used by the Canvas objects.
Remarks
This method subscribes to the scene loaded observable to automatically adjust Canvases when a new scene is loaded.
