Hello, welcome to Microsoft Q&A,
I am not sure of the scenario, but if you simply want to switch different views within the same Unity Scene:
Your position (headset position) is the main camera. If you didn’t attach any script to the second camera, it will keep still. I am not sure of your scenario, if it is required to display views in other cameras on time, you need to create additional cameras and targeting to a customized Render Texture, which should be attached on an object you want to display.
Meanwhile, if it only switches between different views, simply store those transforms of that point Clicking the switching button simply change the transform of Main Camera. Please note that the main camera transform only reflects the position from hardware, so that directly changing transform won’t work. You need to use MixedRealityPlayspace.Transform.Translate() to modify the position.
Meanwhile, if your requirement is switching camera between different Unity Scenes:
May I ask which mode you choose when you load the scene? To be clear, Unity will use Single load mode by default, while in MRTK, MixedRealityToolkit and MixedRealityPlaySpace should be unique and in a scene that is never unloaded. There are 2 suggestions that may help you solve this issue.
- If insisting on using Single mode. You need to add DontDestroyOnLoad() calls for MixedRealityToolkit and MixedRealityPlaySpace and make sure they won't be destroyed when loading the new scene. MixedRealityPlaySpace, MixedRealityToolkit in new scene will be automatically set Inactive and you can manually choose the active MRTK at any time.
- Using Additive load mode. This won't destroy objects in the previous scene, but all objects will be contained in the same scene. Feel free to add codes to set inactive.
Besides manually setting up scene loading behavior, it is also recommended to use the official Scene System. Please refer to https://learn.microsoft.com/en-us/windows/mixed-reality/mrtk-unity/features/scene-system/scene-system-getting-started?view=mrtkunity-2021-05.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.