text
stringlengths
0
1.11k
Scene Loaded Event: Subscribe to this event to initialize your game code (see “Creating a New Scene”).
Scene Settings
Data Source: The transforms that are used to create the Scene Anchors:
Device: Uses the data created on the Quest device through Space Setup (use for Link as well)
Prefab: Uses an artificial room, specified by Room Index and one of the Room Prefabs
DeviceWithPrefabFallback: If no device data exists, use the Prefab room
Room Index: The index (0-based) into the Room Prefabs array; -1 means random
Room Prefabs: The artificial rooms for simulating Scene data. You can create your own simulated rooms by reference the structure and game object naming of the existing room prefabs.
Load Scene on Startup: When enabled, the Scene is automatically loaded if it exists and the SceneLoadedEvent is fired with no other action. When false, you can manually control Scene initialization behavior, such as for using MRUK on non-device rooms (for example, networked).
Seat Width: The width/depth of a person’s seat size, when calculating seat poses on Scene objects with the COUCH label.
EffectMesh
This creates special-effect meshes out of the Scene objects you specify. Each edge has vertex coloring applied, for optional shader usage. A variety of mapping options are available when making the mesh.
EffectMesh
Mesh Material: The material to apply to the constructed mesh. If you’d like a multi-material room, you can use another EffectMesh object with a different Mesh Material.
Border Size: When creating the vertices for edge bounds, this is the “thickness” of each edge. Edge Vertices are colored black, and fade to white over the BorderSize distance. You can see how this is exploited in a shader by examining the SceneMeshOutline.shader used in RoomBoxEffects.mat.
Frames Offset: For quads on walls (for example, doors, windows, wall art), because they exist on the same lateral plane, this can lead to Z-flickering. FramesOffset extends them from wall by this many meters.
Add Colliders- When true`, collision is made for the EffectMesh primitives.
Cast Shadows: Whether the effect mesh objects will cast a shadow.
Hide Mesh: Hide the effect mesh.
Texture Coordinate Modes: How the texture coordinates are applied to the created mesh UVs, generally only used on contiguous WALL_FACE objects. U refers to the horizontal dimension of the room border, and V refers to the vertical.
METRIC: Coordinates start at 0 and increase by 1 unit every meter.
METRIC_SEAMLESS: Coordinates start at 0 and increase by 1 unit every meter but are adjusted to end on a whole number to avoid seams.
MAINTAIN_ASPECT_RATIO: Coordinates are adjusted to the other dimensions to ensure the aspect ratio is maintained.
MAINTAIN_ASPECT_RATIO_SEAMLESS: Coordinates are adjusted to the other dimensions to ensure the aspect ratio is maintained but are adjusted to end on a whole number to avoid seams.
STRETCH: Coordinates range from 0 to 1.
Labels: Which Semantic objects to be included in the EffectMesh.
AnchorPrefabSpawner
If you’re coming from the OVRSceneManager workflow, you can use this instead to instantiate objects at anchor locations.
AnchorPrefabSpawner
Prefabs To Spawn: For each anchor found, a prefab is instantiated using these settings.
Labels: The transform of the Semantic objects to be referenced when instantiating a prefab.
Prefabs: A random prefab from this list is chosen for instantiation.
Match Aspect Ratio: When enabled, the prefab will be rotated to try and match the aspect ratio of the volume as closely as possible. This is most useful for long and thin volumes, keep this disabled for objects with an aspect ratio close to 1:1. Only applies to volumes.
Calculate Facing Direction: When enabled, the prefab will be rotated to face away from the closest wall. If match aspect ratio is also enabled then that will take precedence and it will be constrained to a choice between 2 directions only. Only applies to volumes.
Scaling: Set what scaling mode to apply to the prefab. By default the prefab will be stretched to fit the size of the plane/volume. But in some cases this may not be desirable and can be customized here.
Stretch: Stretch each axis to exactly match the size of the Plane/Volume.
Uniform Scaling: Scale each axis by the same amount to maintain the correct aspect ratio.
Uniform XZ Scale: Scale the X and Z axes uniformly but the Y scale can be different.
No Scaling: Don’t perform any scaling.
Alignment: Spawn new object at the center, top or bottom of the anchor.
Automatic: For volumes align to the base, for planes align to the center.
Bottom: Align the bottom of the prefab with the bottom of the volume or plane.
Center: Align the center of the prefab with the center of the volume or plane.
No Alignment: Don’t add any local offset to the prefab.
Ignore Prefab Size: Don’t analyze prefab, just assume a default scale of 1.
On Prefab Spawned: An event that fires once all prefabs have been instantiated. Subscribe your game code to this event if you have a dependency on the instantiated prefabs. center
FindSpawnPositions
This is a utility to help with instantiating content in unknown, user-defined environments.
FindSpawnPositions
Spawn Object: Prefab to be placed into the scene, or object in the scene to be moved around.
Spawn Amount: Number of SpawnObject(s) to place into the scene, only applies to Prefabs.
Max Iterations: Maximum number of times to attempt spawning/moving an object before giving up.
Spawn Locations: Attach content to scene surfaces.
Labels: When using surface spawning, use this to filter which anchor labels should be included. Eg, spawn only on TABLE or OTHER.
Check Overlaps: If enabled then the spawn position will check colliders to make sure there is no overlap.
Override Bounds: Required free space for the object (Set negative to auto-detect using GetPrefabBounds.)
Layer Mask: Set the layer(s) for the physics bounding box checks, collisions will be avoided with these layers.
SceneDebugger
This isn’t used for creation, but for debugging Scene data. Clicking on an Anchor (with the mouse or right controller) will display its label(s), scale, collision point, and a suggested Pose for placing AR content. In general, the fields here don’t need to be modified.
SceneDebugger
Debug Projectile: When pressing the trigger button, this is the object “shot” out. Note that it is recycled, and should point to an existing object (not a prefab).
Visual Helper Material: The material used to render objects used for debugging.
Logs: The Text object displaying the debug output.
Selection Entry Point: The button in the debug canvas to highlight when the Start button is pressed.
Surface Type Dropdown: The UI dropdown to select a Semantic classification.
Positioning Method Dropdown: When interacting specifically with tops of volumes, this can be used to specify where the return position should be aligned on the surface.
Input Selection Delay: The delay between the fired selection events.
Show Debug Anchors: Visualize anchors with a checker pattern.
Shoot Ball: When disabled, pressing the trigger button does not shoot the Debug Projectile.
RoomGuardian
Creates a Guardian-like protective mesh that renders as a player approaches it, eventually showing Passthrough directly. This is helpful for safety if your scene is intended to be fully virtual instead of using Passthrough. Note that this prefab also has an EffectMesh component on it, which is used to create the mesh. If you’d like to create your own shader, reference the properties in FakeGuardian.shader (_WallScale and _GuardianFade), as this component passes them as parameters.
RoomGuardian
Guardian Distance: This is how far, in meters, the player must be form a surface for the Guardian to become visible (in other words, it blends _GuardianFade from 0 to 1). The “position” of the player is calculated as a point 0.2m above the ground. This is to catch tripping hazards, as well as walls.
SpaceMap
Generates a top-down 2D texture of the room(s). Can be used for point sampling or as a texture in materials.
GetColorAtPosition(): Get the color value of the map from a position in world space
SpaceMap
Texture Map: The texture generated. This asset must have read/write enabled in its import settings.
Map Gradient: The gradient applied to the ramp. The left side is mapped to “Inner Border” and the right side is mapped to “Outer Border”
Inner/Outer Border: Where the Map Gradient is applied, in relation to the surfaces; negative numbers are “inside” the room, and positive are outside.
Map Border: How large the grid/texture should extend beyond the physical boundaries of the room. This should generally match Outer Border, but may need a small buffer if the Texture Map has a wrap mode set to clamp. This ensures the outer pixel perimeter is consistent.
Samples
In addition to the core MR Utility Kit code, you can find sample scenes that showcase how mixed reality environments can be constructed. These samples can be found in the Samples~ folder. You must import these into your project before building or modifying them: open your Package Manager, go to MR Utility Kit, expand the Samples section and click on Import next to Example Scenes.
MRUKBase
This is a simple scene consisting of a few prefabs; MRUK (required), EffectMesh, RoomGuardian, and SceneDebugger (under the LeftHandAnchor transform of OVRCameraRig).