Getting Started

Introduction

Installation

Project Configuration

Testing in Your Sandbox

Samples & Examples

Core Concepts & Glossary

Package Types

Spaces & Space Templates

Custom Avatars

Custom Avatar Animations

Avatar Attachments

Custom Prefab Objects

Embedded Packages

Drivable Vehicles

Scene Setup

Testing In Unity vs Sandbox

Controlling the Camera

Custom Collision, Layers, and Tags

Audio Mixers and Groups

Key Differences from Standard Unity3D development

Economy

Quests and Rewards

Economy Overview

Monetization

Items

Consumable Items

Rewarding Items

World Currency

Selling Items

Scripting

Components

Entrance Point

Camera Passthrough

Interactable

Trigger Event

Point Of Interest

Environment Settings Overrides

Render Pipeline Settings Overrides

Movement Materials

Climbable

Avatar Teleporter

Empty Frame

Projector Surface

Seat Hotspot

Guidelines

Supported Features and Limitations

Performance Guidelines

Lighting

Publishing to Spatial

Finding Published Packages

Support

FAQs

Help and Support

Release Notes

Asset Import Settings

C# Scripting API Limitations

In order to maintain compatibility with all our platforms and to create a secure experience only specific allow-listed APIs can be used in Spatial.

If you try to use an unsupported API you will be notified in the issues tab and blocked from uploading.

Where can I use C# scripts?

C# scripts are currently available for Spaces made using the Spatial Creator Toolkit. Other types of content do not support scripting.

What APIs Can I Use from C#?

Currently we support a significant portion of APIs in the following modules mscorlib UnityEngine.CoreModule UnityEngine.AudioModule UnityEngine.PhysicsModule UnityEngine.AnimationModule UnityEngine.UIModule UnityEngine.UI Unity.TextMeshPro

UnityEngine API Replacements

Some Unity API’s are very important but need to be partially restricted, or modified to operate safely inside spatial. The replacements are as follows. Application.OpenURLSpatialBridge.spaceService.OpenURL Camera.Main.___SpatialBridge.cameraService

What APIs CAN’T I Use?

We can’t list all 5000+ currently blocked API calls here… but here are some common ones we have blocked:

Use of the unsafe Keyword Editor scripts ⇒ allowed, as long as you move them to a Editor folder or use a #if UNITY_EDITOR directive Most Application APIs like Application.OpenURL Any SendMessage variant Any System.Reflection APIs System.IO.File System.IO.Directoryand any APIs dealing with the file system Any Scene or SceneManagement related APIs — use alternate strategies instead DontDestroyOnLoad — interferes with object lifecycles TimeScale Time.fixedTimeDelta (setter) maxDeltaTime — no modification of time settings DestroyImmediate — use Destroy instead PlayerPrefs — use the Spatial SDK [DataStore](<https://spatialxr.notion.site/bb74656a00f342189cd5177a0a88c8eb>) instead Resourcesuse AssetBundle instead Camera.main Camera.allCameras Camera.current — use the Spatial SDK Camera APIs instead Networking APIs (UnityWebRequest www) QualitySettings

I Need to Use Editor Scripts With My Code

See Excluding Editor code for how you can mix Editor-only code inside the directory that contains your C# runtime scripts.

I Need to Use ___ API But It’s Not Supported

If you need functionality of a certain API that is not supported definitely let us know! We might be able to expand our supported APIs or write similar functionality in a Spatial-unique API.

The best place to give this kind of feedback directly to the team is the Creator Toolkit section of the Spatial Discord


← Previous

Your First Script

Next →

Third-Party Unity Packages