menu_bookDocumentation

Libraries - s&box Code Documentation

calendar_today May 5, 2026 schedule ~2 min read person patrickjr verified 50

Libraries

Libraries are reusable code packages you can share between projects or distribute to others. They provide a way to modularize your code and avoid duplication.

How It Works

Libraries are stored in the Libraries folder in your project:

CODE
MyProject/
  ├── Libraries/
  │   └── MyLibrary/
  │       ├── Assets/
  │       ├── Code/
  │       └── Editor/
  └── Code/

Each library has its own folder with its own Assets, Code, and Editor folders.

The game code and editor code reference all installed libraries, so you can access any classes defined in the library. But a library cannot access the game code directly — this prevents circular dependencies.

Why It Works Like This

Libraries aren't compiled assemblies. When you share your library, you are sharing the source code. This means:

  • Full source is available to users
  • Hotloading works across library boundaries
  • No binary compatibility issues
  • Easy to modify and extend

Library Manager

Manage libraries via the Library Manager window:

  1. Tools → Library Manager
  2. Install from local folder
  3. Install from Git URL
  4. Update installed libraries

Publishing

Publish libraries to GitHub or other git hosts:

  1. Create a git repository for your library
  2. Push the library folder contents
  3. Others can install via git URL
CODE
https://github.com/username/MySboxLibrary

Limitations

  • Libraries cannot reference the game project
  • Keep library dependencies minimal
  • Version control libraries separately

Best Practices

  • Give libraries descriptive names
  • Include documentation in the library
  • Use semantic versioning
  • Test libraries in isolation
Was this helpful?