
Rust bindings for Godot 4
Website | GitHub | Book | API Docs
Discord | BlueSky | Mastodon | Twitter | Sponsor
The godot crate integrates the Rust language with Godot 4.
Godot is an open-source game engine, focusing on a productive and batteries-included 2D and 3D experience. Its GDExtension API allows integrating third-party languages and libraries.
Philosophy
The Rust binding is an alternative to GDScript, with a focus on type safety, scalability and performance.
The primary goal of this library is to provide a pragmatic Rust API for game developers. Recurring workflows should be simple and require minimal boilerplate. APIs are designed to be safe and idiomatic Rust wherever possible. Due to interacting with Godot as a C++ engine, we sometimes follow unconventional approaches to provide a good user experience.
Example
The following Rust snippet registers a Godot class Player, showcasing features such as inheritance, field initialization and signals.
use ;
use *;
// Declare the Player class inheriting Sprite2D.
// Automatic initialization, no manual init() needed.
// Implement Godot's virtual methods via predefined trait.
// Implement custom methods that can be called from GDScript.