Support for C# development in Spatial will be rolling out starting in December 2023 as a private Beta, with wider availability starting in January 2024.
📌 Sign Up To Apply to Join the Beta
In order to maintain compatibility with all of 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 be 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
+ Spatial-specific APIsWhat 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:
Any
static
variables
Use of the unsafe
Keyword
Any Editor scripts
Any Application
API like Application.OpenURL
Any GameObject.Find
variant
Any GameObject.SendMessage
variant
Any SendMessage
variant
Any System.Reflection
APIs
Any System.IO
APIs
Any Scene
or SceneManagement
related APIs
DontDestroyOnLoad
— interferes with object lifecycles
TimeScale
Time.fixedTimeDelta (setter)
maxDeltaTime
— no modification of time settings
DestroyImmediate
— use Destroy
instead
PlayerPrefs
— use DataStore
instead
Resources
— use AssetBundle
instead
Camera.main
Camera.allCameras
Camera.current
— use the Spatial SDK APIs instead
Networking APIs (UnityWebRequest
www
)
QualitySettings
Known Issues
The following are not available currently and we are working on a resolution:
Generic APIs such as
Action<>
and Job<>
Using custom structs as properties in a MonoBehaviourI 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