Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Rust Tools

An asset by thomastc
The page banner background of a mountain and forest
Rust Tools thumbnail image
Rust Tools thumbnail image
Rust Tools hero image

Quick Information

0 ratings
Rust Tools icon image
thomastc
Rust Tools

A suite of utilities for working with Rust GDExtensions:- Compile your Rust code with the click of a button, and see the compile output right in the Godot editor. Code is also compiled automatically before running your project.- Enable Rust backtraces for your running project.- Automatically generate Rust code for names defined in the editor: input actions, layer names and global groups.Much more could be added, and PRs are welcome! Please get in touch through the issue tracker if you have an idea for improving this plugin.

Supported Engine Version
4.5
Version String
0.1.1
License Version
MIT
Support Level
community
Modified Date
1 day ago
Git URL
Issue URL

Godot Rust Tools

README Godot Rust Tools icon: a hammer inside the Rust gear, with small letters "rs" written next to it

Godot Rust Tools, or "Rust Tools" for short, is a plugin for Godot 4 to help with development of extensions written in Rust.

gdext is the canonical and recommended library for using GDExtension from Rust, but this plugin does not depend on it and can work just as well with custom bindings.

Features

  • Build Rust code right from the Godot editor, and automatically reload the extension if the build succeeds. Builds are also triggered automatically when running your game.
  • Enable Rust backtraces when running your game.
  • Automatically generate Rust constants for names defined in the editor: input actions, layer names and global groups.

Requirements

The plugin requires Godot 4.5 or greater.

Platform support:

  • Linux & Windows: Supported and tested, should work right out the box.
  • Android: Should work on rooted devices, but untested.
  • MacOS: Should be supported but untested; there may be problems with sandboxing. Please report if it works or doesn't work.

Installation

Installation from the Godot Asset Libary (recommended):

  1. Head over to the AssetLib tab in the Godot editor.
  2. Search for "Rust Tools".
  3. Click the plugin's icon or name, then follow the steps to download and install it.

Manual installation:

  1. Download this plugin's project files from GitHub.
  2. Copy the addons/rust_tools folder to the addons folder in your own Godot project, creating it if necessary. Files outside addons/rust_tools are not needed to use the plugin.

Usage

After enabling the plugin, you'll see some new toolbar buttons to the left of the usual ones, marked with a little rs icon:

README A screenshot of Godot's top left toolbar, with three additional buttons: one displaying a call stack, one a broom and one a hammer. All three have an overlay with the letters "rs".

From left to right:

  • Rust Backtrace: toggle RUST_BACKTRACE=1 in the environment of the running project, for more detailed panic reporting. Note that this only takes effect on newly started projects, not on currently running ones.
  • Clean: runs cargo clean.
  • Build: runs cargo build.

Build output goes to the Output pane at the bottom:

README A screenshot of Godot's Output pane, showing the output of a cargo build process

cargo build is also invoked automatically when you run or export your project, so you'll never get out-of-date code. However, due to limitations in the Godot API, these invocations must run synchronously, blocking the editor UI.

Before you can run the build, you will need to tell Rust Tools about your Rust code; see the REQUIRED items under Configuration below.

Configuration

Project Settings

These can be found under Project > Project Settings… > Rust Tools.

  • Cargo Package Directories (REQUIRED)

    You need to tell Rust Tools which cargo package(s) to build, by adding their path(s) to the Cargo Package Directories setting.

    Note that this path is relative to the Godot project itself, so:

    • If the Rust code is in a subfolder of the Godot project, specify the name of that folder here.
    • If the Rust code is in a sibling folder next to the Godot project, use ".." to indicate the parent folder, for example "../rust".
  • Gdextension Files (REQUIRED)

    For autoreload to work, it needs to know which GDExtension files need to be reloaded. Specify those here.

  • Generated Constants File Paths

    If specified, Rust Tools will automatically generate constants containing Input Actions, Global Groups names and user-defined Layer Names. The file will be (re)generated upon detecing a change in project settings, and right before a build; you can trigger it manually by using the Command Palette (Ctrl+Shift+P) and choosing Rust Tools > Regenerate Constants.

Editor Settings

These settings apply to all projects using Rust Tools, and can be found under Editor > Editor Settings… > Rust Tools.

  • Cargo Executable

    If you don't have cargo in your PATH, you need to tell the editor where to find it. Set Cargo Executable to the absolute path to the cargo or cargo.exe executable.

    The default, plain cargo, is fine if its containing folder is on your PATH.

  • Enable Autoreload

    By default, Rust Tools automatically reloads extensions after a rebuild. You can turn that off here. (Normally, Godot only reloads after the editor window loses and regains focus.)

License

This plugin is under the MIT license, like Godot itself. See LICENSE.md.

The Rust logo is distributed under the terms of the Creative Commons Attribution license (CC-BY).

This project is not affiliated with, or endorsed by, the Rust Project or Rust Foundation.

A suite of utilities for working with Rust GDExtensions:

- Compile your Rust code with the click of a button, and see the compile output right in the Godot editor. Code is also compiled automatically before running your project.
- Enable Rust backtraces for your running project.
- Automatically generate Rust code for names defined in the editor: input actions, layer names and global groups.

Much more could be added, and PRs are welcome! Please get in touch through the issue tracker if you have an idea for improving this plugin.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Rust Tools icon image
thomastc
Rust Tools

A suite of utilities for working with Rust GDExtensions:- Compile your Rust code with the click of a button, and see the compile output right in the Godot editor. Code is also compiled automatically before running your project.- Enable Rust backtraces for your running project.- Automatically generate Rust code for names defined in the editor: input actions, layer names and global groups.Much more could be added, and PRs are welcome! Please get in touch through the issue tracker if you have an idea for improving this plugin.

Supported Engine Version
4.5
Version String
0.1.1
License Version
MIT
Support Level
community
Modified Date
1 day ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers