S&box Wiki
Home
/
Edit Creating a Tool
View
Edit
History
No Category
Developer Overview
The Project System
Publishing To Asset Party
Getting Started With Hammer
Mapping Basics
Mapping Entities
Advanced Mapping Techniques
Getting Started with Modeldoc
Animgraph & Animation
Physics
Modeldoc Nodes
Advanced Modelling
UI Basics
Styles & Stylesheets
Razor Templates
Game Menus
Materials
Built In Shaders
Shaders
Shader Reference
Sounds & Audio
Particles
Getting Started
Making Games
Input
Networking
Physics
Rendering
Editor & Tools
VR
Misc
Playing Guides
Console Commands & Variables
Dedicated Server
Log in to edit
Creating a Tool
<cat>Code.Editor</cat> <title>Creating a Tool</title> <warning>Tool projects do not exist, but most of the code still applies to *Editor Tools*</warning> # What is a Tool? Sometimes your game may require certain tools that s&box may not provide to you out of the box. In cases like these it can be beneficial to develop your own set of tools that allow you to automate and/or ease certain tasks. A tool can be anything from an editor with a few sliders and a text entry to a turntable spritesheet renderer. <note>Tools cannot be published/uploaded to [asset.party](https://asset.party/).</note> If you want others to be able to use your tool, the convention is to upload it to GitHub with the **sbox** and **sbox-tool** topics on the repository. If you prefer to learn from example, you may want to look at [these repositories](https://github.com/topics/sbox-tool). # Creating a new Tool If you are making a game-specific tool, then all you have to do is create a new folder named `editor` in the code folder of your game project. From here you can follow the next section and place any .cs files for your tool in here. This will ensure that the tool is only loaded when you are editing that game project. If you are **not** making a game-specific tool, and instead want to make a tool that is always loaded in the editor no matter what, you must create a new "Tool" project. <upload src="b50e6/8dbb9595123f7be.png" size="25877" name="image.png" /> # Defining a Tool Window When your tool is loaded in the editor, it will look for any `DockWindow` that has a `[Tool]` attribute and add it to the Tools Menu and sidebar in your Editor. You can then open that window at any time by clicking on the tool in the list. You can define a custom window of your own like such: ```cs [Tool( "My Custom Editor", "rocket", "Edits custom things!" )] public partial class MainWindow : DockWindow { public MainWindow() { DeleteOnClose = true; Size = new Vector2(480, 360); Title = "My Custom Editor"; } } ``` # Defining a Tool Dock A Dock is similar to a Window but is meant to be primarily used while docked (but can still be pulled away as a floaty window). Docks are added to the View Menu in your Editor and can be toggled on/off. You can define a custom dock like this: ```cs [Dock( "Editor", "My Custom Dock", "snippet_folder" )] public class MyCustomDock : Widget { public MyCustomDock(Widget parent) : base(parent) { var button = new Button( "Ping", "arrow_upward" ); button.Clicked = () => { Log.Info( "Pong" ); } } } ``` Learn more about the dock attribute <page text="here">Guide_to_Widgets#option1widgetwithdockattribute</page> # Defining a Tool Menu A Menu is a custom drop-down added to your Editor's Menu Bar. These are useful for holding shortcuts and options that are specific to your tool that you would want regular and/or easy access to. You can create one like such: ```cs public class MyCustomMenu { [Menu( "Editor", "My Custom Menu/Custom Option 1" )] public static void CustomOption1() { Log.Info( "Pressed the first option!" ); } [Menu( "Editor", "My Custom Menu/Custom Option 2" )] public static void CustomOption2() { Log.Info( "Pressed the second option!" ); } } ```
S&box Wiki
Development
Developer Overview
6
Editor Overview
General FAQ
System Requirements
The s&box wiki
Troubleshooting
Useful Links
The Project System
4
Adding Assets
Creating a Game Project
Project Settings Window - Games
Project Types
Publishing To Asset Party
2
Uploading assets
Uploading projects
Hammer
Getting Started With Hammer
3
Getting Started With Hammer
Making Your First Map
Mapping Resources
Mapping Basics
7
Cordons
Hotspot Materials
Selection Sets
Standard Mapping Dimensions
Tool Materials
Tools Visualisation Modes
Using Entities That Require a Mesh
Mapping Entities
2
Creating a Door
Light Entities
Advanced Mapping Techniques
8
Collaborating With Prefabs and Git
Instances
Prefabs
Quixel Bridge Plugin
Tilesets
Tilesets-Advanced
Tilesets-Proxies
VIS Optimizations
Models & Animation
Getting Started with Modeldoc
7
Automatic Model Setup
Breakpieces
Creating a Model
Guide to Models
Importing Rust Weapons
LODs
ModelDoc FAQ & best practices
Animgraph & Animation
4
Animations without Animgraph
AnimEvents, AnimGraph Tags, Attachments
Animgraph
Delta Animations
Physics
3
Cloth Physics
Collisions, Physics & Surface Types
Jiggle Bones
Modeldoc Nodes
1
Custom ModelDoc nodes
Advanced Modelling
6
Bodygroups
Citizen
First Person
IKChains and Stride Retargeting
Morphs
Vertex Normals
User Interface
UI Basics
7
Custom Fonts
Embedding Websites
Enabling Pointer Events
Events and Input
Localization
UI Basics
UI with Components
Styles & Stylesheets
1
Video Backgrounds
Razor Templates
4
A Razor Overview
Aliases and SetProperty Attributes
Generic Components
Templates
Game Menus
1
Making a Custom Pause Screen
Materials & Shaders
Materials
5
Guide to Materials
Material Attributes
Material Resources
Texture Settings
Using Dynamic Expressions
Built In Shaders
2
Foliage Shader
Glass Shader
Shaders
4
Compute Shaders
Constant Buffers
Material API
Shading Model
Shader Reference
5
Anatomy of Shader Files
Getting rid of Tex2D macros
Shader Reference
Shader States
Texture Format Cheat-Sheet
Other Assets
Sounds & Audio
3
Guide to Sounds
Sound Events
Soundscapes
Particles
5
Creating animated sprites
Creating your first particle effect
Understanding Particle Editor
Using custom sprites
Using particle systems from C#
Coding
Getting Started
5
Cheat Sheet
Learning Resources
Setting up Rider
Setting up Visual Studio
Setting up Visual Studio Code
Making Games
2
Components
GameObjects
Input
4
Commands
ConVars
Input System
Speech Recognition
Networking
8
Auth Tokens
Http Requests
Lobby System
Networked Types
Networking Basics
RPCs
Setting Up Networking
WebSockets
Physics
4
Collisions
Hitboxes
Traces
Triggers
Rendering
3
Render Tags
RenderHooks
Scenes
Editor & Tools
7
Creating a Tool
Custom Asset Types
Guide to Widgets
Hammer API
Hammer Gizmos
Hotload Performance
Widget Docking
VR
3
Getting Started
VR Input
VR Overlays
Misc
13
Asset Types
Attributes and Component Properties
Backend API
Cloud Assets in code
Code Accesslist
CPU Performance Profiling
DisplayInfo
FileSystem
Mounting assets at runtime
package/find
Setting Up A Navigation Mesh
Threaded Tasks
TypeLibrary
Playing
Playing Guides
3
Default Keybinds
Proton
s&box on macOS (Experimental)
Console Commands & Variables
1
Launch Arguments
Dedicated Server
1
Dedicated Servers