A Godot 4 plugin that lets you name your collision and render layers, inspired by Unity's layer system. Instead of remembering which number corresponds to which layer, just use names directly in your code.
In Godot, layers are just numbers: collision_mask = 4 # What is layer 4 again...?
With Layer Namer you can do this: collision_mask = LayerNames.get_mask("Enemies")
- Name up to 32 layers from the editor panel
- Names persist across sessions
- Access layers by name in any script via the LayerNames autoload
- Lightweight, no dependencies
- Download or clone this repository
- Copy the
addons/layer_namerfolder into your project'saddons/folder - Go to
Project → Project Settings → Plugins - Enable Layer Namer
After enabling the plugin, open the Layer Namer panel in the bottom-right dock and assign names to your layers.
# Get the layer number by name
var layer = LayerNames.get_layer("Enemies") # returns 1, 2, 3...
# Get the bitmask directly for collision_mask
collision_mask = LayerNames.get_mask("Enemies")
# Get the name of a layer by its number
var name = LayerNames.get_layer_name(1)- Godot 4.x
- GDScript
MIT License
