Skip to content

williamgcode/godot-layer-namer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Godot Layer Namer

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.

LayerNamer

The Problem

In Godot, layers are just numbers: collision_mask = 4 # What is layer 4 again...?

The Solution

With Layer Namer you can do this: collision_mask = LayerNames.get_mask("Enemies")

Features

  • 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

Installation

  1. Download or clone this repository
  2. Copy the addons/layer_namer folder into your project's addons/ folder
  3. Go to Project → Project Settings → Plugins
  4. Enable Layer Namer

Usage

Naming your layers

After enabling the plugin, open the Layer Namer panel in the bottom-right dock and assign names to your layers.

Using layer names in code

# 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)

Compatibility

  • Godot 4.x
  • GDScript

License

MIT License

About

A Godot 4 plugin to name your collision and render layers, inspired by Unity's layer system.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors