When a new class is created and exposed to scripting, the editor’s interface will display it with a default icon representing the base class it inherits from. Yet in most cases it is recommended to create icons for new classes to improve the user experience.
In order to create new icons, you first need a vector graphics editor installed. For instance, you can use the open-source Inkscape editor.
godot-design repository containing all the original editor icons:
git clone https://github.com/godotengine/godot-design
The icons must be created in a vector graphics editor in
svg format. You
engine/icons/inkscape_template.svg with default icon properties
already set up.
Once you’re satisfied with the icon’s design, save the icon in
engine/icons/svg/ folder. But in order for the engine to automatically
pick up the icons, each icon’s filename:
Must be prefixed with
PascalCasename should be converted to
snake_case, so words are separated by
_whenever case changes, and uppercase acronyms must also have all letters, numbers, and special characters separated as distinct words. Some examples:
Because the editor renders the
svg’s at runtime, they need to be small
in size, so they can be efficiently parsed. Editor icons must be first
optimized before being added to the engine, to do so:
Add them to the
optimize.pyscript. You must have the
pip install scour cd godot-design/engine/icons && ./optimize.py
The optimized icons will be generated in the
Integrating and sharing the icons¶
If you’re contributing to the engine itself, you should make a pull request to
add optimized icons to
godot/editor/icons in the main repository. Recompile
the engine to make sure it does pick up new icons for classes. Once merged,
don’t forget to add the original version of the icons to the
repository so that the icon can be improved upon by other contributors.
It’s also possible to create custom icons within a module. If you’re creating your own module and don’t plan to integrate it with Godot, you don’t need to make a separate pull request for your icons to be available within the editor as they can be self-contained.
For specific instructions on how to create module icons, refer to Creating custom module icons.
If icons don’t appear in the editor make sure that:
- Each icon’s filename matches the naming requirement as described previously.
modules/svgis enabled (should be enabled by default). Without it, icons won’t appear in the editor at all.