World Space Manager
Workflow
A component responsible for handling 3D/world space canvas rendering. It requires some variables for rendering, such as; a main camera, an external camera for DreamOS Canvas, a render texture and an enter mount. Instead of assigning or creating those variables one by one, you can simply use ‘Tools > DreamOS > Create World Space Resources’.
Controller
World Space Resources includes a simple player controller. Here’s a step-by-step guide to get rid of it and implement your own character controller:
- Select the World Space Resources > Player Controller object and delete it.
- In order to move your camera to the mount smoothly, you need to disable the camera control On Enter, and then enable On Exit. This kind of depends on your camera controller/system, but you can disable the camera controller On Enter, disable the whole Main Camera object On Enter End, enable the camera object On Exit, and then lastly enable the camera controller On Exit End. This might sound a bit confusing, but you can understand the logic after looking at the example player controller.
- World Space Resources comes with some 3D environment that is purely for demonstration. You can delete them as you like. Make sure that you don’t delete the ‘DreamOS OS Renderer’ object, which you can find at World Space Resources > Environment > Monitor.
- There’s an object called ‘Enter Mount’. It’s basically a transform that makes the transition between the DreamOS canvas and the player camera. You can change its position based on your needs.
You can tweak some settings using the World Space Manager component. In order to make the transition, this system requires a collider. You can add a collider (e.g. Box Collider) to the object (if not available already).
Scripting
using UnityEngine;
using Michsky.DreamOS; // DreamOS namespace
public class SampleClass : MonoBehaviour
{
[SerializeField] private WorldSpaceManager wsManager; // Manager variable
void YourFunction()
{
// Enable or disable auto get in on collider enter
wsManager.autoGetIn = true;
// When enabled, DreamOS will remain disabled at start
wsManager.requiresOpening = true;
// Set the transition time
wsManager.transitionTime = 1f;
// Enable or disable camera
wsManager.EnableCamera(true);
// Get in or get out
wsManager.GetIn();
wsManager.GetOut();
// Add events
wsManager.onTriggerEnter.AddListener(TestEvent);
wsManager.onTriggerExit.AddListener(TestEvent);
wsManager.onEnter.AddListener(TestEvent);
wsManager.onEnterEnd.AddListener(TestEvent);
wsManager.onExit.AddListener(TestEvent);
wsManager.onExitEnd.AddListener(TestEvent);
}
void TestEvent()
{
Debug.Log("Event fired");
}
}
How can we help?
A premium WordPress theme with an integrated Knowledge Base,
providing 24/7 community-based support.