menu_bookDocumentation
Libraries - s&box Code Documentation
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:
- Tools → Library Manager
- Install from local folder
- Install from Git URL
- Update installed libraries
Publishing
Publish libraries to GitHub or other git hosts:
- Create a git repository for your library
- Push the library folder contents
- Others can install via git URL
CODE
https://github.com/username/MySboxLibraryLimitations
- 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?