S&box Wiki

Getting Started With Libraries

Getting Started with Libraries

Making games is awesome, but so are creating tools to help others make games. So let's make a Library.

Libraries can be components, editor tools, helpers, etc. Anything you can think of really.

Libraries are different from assets, requiring a special tab to create and publish, we'll start at the beginning.

Creating a Library

First, you'll need a project if you don't have one. Don't worry, if you're in the middle of making a game you can use that project as well. Libraries are like self-contained mini-projects.

Now that we're in a project, let's open the Library Manager. If this isn't displayed by default, you can find it by clicking View in the top left of your editor and selecting the Library Manager. This will open a new window that you can dock anywhere you want, for now, let's dock it next to the Asset Browser.

With the Library Manager opened, we can make our Library by clicking the + button

image.png

You should then be prompted to name your library, name it whatever, probably something that pertains to your goal. Your library should now show up in the Installed category. If it hasn't try restarting your editor. Now all you need to do is make your way over to your IDE and find your Library.

Coding with Libraries

Libraries are pretty much identical in structure to a normal project. You will have your standard and editor projects. All if not most information that can be gleaned from the docs can be used in a Library context.

image.png

Additionally, much like normal editor projects, the editor project of your Library will not be subjected to the S&Box whitelist and you will still be allowed to upload your library.

Publishing a Library

You've just made your awesome Library, so now let's share it with the world. Head back over to the Library Manager and right-click your library, you will have the option to Publish Project, click that and your Publisher wizard will show up. Now's a good time to give a proper name if you haven't. You will also need to select the organization you wish to list it under here as well.

image.png
Names can be changed after publishing, your indent, however, is permanent.
Due to a bug, Libraries that do not have a Code folder with a valid .cs file inside will not work correctly for users. Please make sure you have this before publishing, otherwise your Library is unusable. Drag the default MyLibraryComponent into the Code folder to ensure this does not happen.
rider64_8UvhbqehTY.png

Then, just hit next and your Library is now published, it won't be public, however.

You'll need to head to sbox.game

Configuring your Library on sbox.game

With a published library, we'll now be able to right-click our Library in the Library Manager, and View in Browser. This will take us immediately to our Library's page. From here, we'll hit Configure.

Set a good description for your library, and make sure the end-user will be able to know exactly what this library is accomplishing just from your page. They shouldn't need to download it to see what it does!

Add screenshots showcasing your Library's functionality in the Screenshots tab, and if you have a really nice video you want to share, you can upload it through the Videos tab.

Make sure to properly tag your library and set its category as well.

Once you're finished configuring, let's flip the switch and turn Hidden to Released and Save Changes.