Godot Traits's icon

Godot Traits 0.5.0 Scripts 4.2 Community

Submitted by user Aendawyn; MIT; 2024-02-24

Traits made easy in Godot 4

Godot Traits is an addon designed to bring traits into GDScript. A trait embodies a collection of behaviors (variables, functions, signals, etc.) that can be utilized to extend the functionalities of a class.

Given that Godot Engine lacks an official interface system, many developers resort to composition for combining various behaviors in a single class. However, implementing composition correctly can become complex and inconsistent. This addon's goal is to offer a streamlined and accessible approach for adding and removing behaviors from objects in Godot. This is achieved by defining trait classes and attaching them to objects, and using auto-generated utilities to use them.

Features:
- Trait declaration using annotation
- Auto-generated trait helper class to manipulate traits
- Scenes and nodes as traits,
- Strongly-typed traits and autocompletion
- Strong trait usage runtime checks
- Dynamic addition and removal of traits
- Automatic trait dependencies injection
- Traits inheritance


View files Download Submit an issue Recent Edits