Develop

Unity Utility Packages

Updated: May 7, 2026

Overview

This sample demonstrates production-ready utility patterns for Unity development, including singleton architectures, auto-wiring systems, Burst-compiled physics simulations, and layered multiplayer networking. The repository contains 10 packages (4 general Unity utilities and 6 XR-specific tools), all extracted from Meta’s production projects including the North Star graphical showcase.

Learning objectives

Complete this guide to learn how to:
  • implement three-level singleton patterns (component-based, network-aware, and manual static instances)
  • use automatic component wiring with the [AutoSet] attribute system to eliminate manual GetComponent calls
  • apply Burst-compiled parallel job patterns for physics simulation, including Verlet integration for rope physics and inverse Fast Fourier Transform (iFFT) ocean waves
  • build layered multiplayer architecture separating transport (Photon), session (Netcode), and application state
  • create ScriptableObject-based configuration systems for narrative tasks, environment profiles, and tutorial frameworks

Requirements

  • Meta Quest headset (required for XR-specific packages; general Unity utilities have no device requirements)
  • Unity 2021.3 or later with Unity Package Manager and Git LFS
For detailed SDK versions, toolchain requirements, and build prerequisites, see the repository README.

Get started

Clone the repository or install individual packages via Unity Package Manager. To add a package, paste its Git URL into the Package Manager’s Add package from git URL option. For example: https://github.com/meta-quest/Unity-UtilityPackages.git?path=com.meta.utilities. General Unity utilities have no SDK dependencies; XR utilities require the Meta XR SDK.

Explore the sample

General Unity utilities

PackageWhat it demonstratesKey concepts
com.meta.utilities
Singleton patterns, automatic component wiring, type-safe enum dictionaries, and 40+ extension methods
Singleton<T>, Multiton<T>, [AutoSet] attributes, EnumDictionary
com.meta.utilities.narrative
Task-based narrative system with sequencing, conditions, and event broadcasting
TaskManager (ScriptableObject singleton), TaskSequence, TaskHandler
com.meta.utilities.viewport-renderer
Stencil-based portal rendering without intermediate render textures, optimized for XR stereo
ViewportRenderer extending URP’s DrawObjectsPass
com.meta.utilities.watch-window
Real-time C# expression evaluation in the Unity Editor using Roslyn
Expression graphing, variable references, private member access via Window > Analysis > Watch Window

XR utilities

PackageWhat it demonstratesKey concepts
com.meta.utilities.input
Desktop simulation of XR input and body tracking data bridging
XRDeviceFpsSimulator, XRInputManager
com.meta.utilities.avatars
Networking-agnostic avatar entity with body tracking, lip sync, and face/eye pose
AvatarEntity extending OvrAvatarEntity, IAvatarNetworking interface
com.meta.utilities.environment
Complete ocean and weather simulation system from the North Star showcase
iFFT-based ocean with Burst jobs, environment profiles, rain and wind systems
com.meta.utilities.ropes
Verlet-based rope physics with anchoring, wrapping, and hand interaction
[BurstCompile] jobs for node simulation and constraints, RopeSystem
com.meta.multiplayer.netcode-photon
Three-layer multiplayer architecture with transport, session, and application state
NetworkLayer state machine with host migration, NetworkSingleton<T>
com.meta.tutorial.framework
Editor-based tutorial system parsing markdown into interactive in-editor pages
Meta > Tutorial Hub > Show Hub menu, ScriptableObject config

Runtime behavior

The packages provide reusable infrastructure rather than standalone demo scenes. The environment package renders iFFT ocean waves with quadtree LOD. The rope package simulates Verlet physics with hand interaction. The multiplayer package manages a 13-state client lifecycle from matchmaking through host migration.

Key concepts

Three-level singleton pattern

The sample demonstrates singleton implementation at three abstraction levels. Singleton<T> provides automatic instance management for MonoBehaviour components with FindObjectOfType fallback and DontDestroyOnLoad persistence. NetworkSingleton<T> extends this for NetworkBehaviour components, adding network spawn and despawn handling. For classes that cannot inherit from MonoBehaviour, the manual static Instance pattern provides explicit lifecycle control.

AutoSet attribute system

The AutoSet attributes eliminate repetitive GetComponent boilerplate by automatically wiring component references during editor serialization. [AutoSet] searches the same GameObject, [AutoSetFromParent] traverses up the hierarchy, and [AutoSetFromChildren] searches descendants. The system runs at edit time, meaning zero runtime cost:
[AutoSet] private Rigidbody _rigidbody;
[AutoSetFromParent] private PlayerController _controller;
[AutoSetFromChildren] private Renderer[] _renderers;

Burst jobs for physics simulation

Both the rope and ocean packages use Burst-compiled IJobParallelFor jobs to parallelize physics calculations across CPU cores. The rope system splits Verlet integration into three job types: node simulation (velocity and gravity), distance constraints (segment length preservation), and boundary constraints (anchoring and collision):
[BurstCompile]
struct SimulateNodesJob : IJobParallelFor {
    public void Execute(int index) {
        // Update position using previous velocity + gravity
    }
}

Layered network architecture

The multiplayer package separates networking into three layers with distinct responsibilities. The transport layer (Photon Realtime) handles packet delivery and room management. The session layer (Netcode for GameObjects) manages NetworkObject spawning, ownership, and RPCs. The application layer (NetworkLayer state machine) handles user-facing concerns: matchmaking, loading screens, host migration, reconnection, and graceful disconnection across 13 distinct client states.

Extend the sample

  • Combine the narrative system with multiplayer by extending TaskManager with NetworkSingleton<T> and adding RPCs to synchronize task state across clients.
  • Create custom environment profiles for different weather conditions and extend the ocean simulation with caustics rendering.
  • Integrate the Watch Window for multiplayer debugging to monitor NetworkLayer state transitions during sessions.