GDSense how-to guide

How to Use AI in Godot: A Practical GDScript Workflow

Take one Godot task from a clear prompt and focused scene context to a reviewed GDScript change and a repeatable gameplay check.

Published Updated

All documentation guides

The short answer

Use AI in Godot as a partner for one verifiable task at a time: describe the behavior, provide the relevant script and scene, ask for a small change, and test the result in the editor. In GDSense, choose Chat to understand a problem, Quick Edit for a focused code change, or Agent for connected steps. You still own the design and verification.

What is a good first task for an AI assistant?

Choose an outcome you can check in a minute: explain a failing node lookup, prevent a button from firing twice, or simplify one damage calculation. A request to build an entire game hides too many decisions. A narrow task gives you a useful answer even when the assistant needs more evidence.

For this walkthrough, the goal is a pause menu: pressing the pause action opens it, Resume closes it, gameplay stops while it is visible, and the menu still receives input. Write these four checks before asking for code. They are the acceptance criteria, not details to invent after the implementation.

  • Save a version-control checkpoint or backup of the working project.
  • Record the Godot version, affected scene, and existing Input Map action names.
  • Run the current scene and note what already works.
  • Choose one script or small group of files as the allowed edit scope.

Should I use Chat, Quick Edit, or Agent?

Choose by the work you want done, then choose the reasoning depth. These are separate decisions: a difficult explanation can stay in Chat, while a routine change across two files can be an Agent task. Plan access can limit which workflows and reasoning modes are available.

Pick the smallest workflow that fits
NeedWorkflowUseful request
Understand behavior before editingChatTrace how this pause state reaches the menu. Do not edit files.
Change a selected blockQuick Edit or RefactorExtract this repeated check; preserve the signal and method names.
Inspect and update connected filesAgentImplement the agreed pause behavior within these two scripts, then report the checks.
Check current GDSense workflow and mode access

What context should I give the AI?

Attach the script that owns the behavior and the scene that supplies its nodes. Include exact error text and actual paths. GDSense has workflow-specific context, including Agent’s shallow path-name tree, but that is not the same as reading every file. Explicit attachments make the evidence for your question clear.

For a pause menu, the assistant needs the pause controller, menu script, node hierarchy, and the relevant Input Map action. It does not need unrelated levels or textures. Review project rules in res://AGENTS.md when working in a newly cloned project, and never include API keys or export-signing credentials in a prompt.

A bounded first request in Chat
@file res://scripts/pause_controller.gd
@scene res://ui/pause_menu.tscn --scripts
I am using Godot 4.7. The Input Map action is "pause".
Expected: the action opens the menu and pauses gameplay; Resume unpauses and hides it.
Actual: the menu opens but Resume does not respond while paused.
Trace the cause first. Identify which node process modes matter and ask if context is missing. Do not edit files yet.
Godot pausing games and process modes

How do I turn the answer into a safe change?

Ask the assistant to identify the cause, the exact edit boundary, and the test before applying its proposal. A good answer separates facts visible in your files from assumptions. If it invents a node or action name, supply the real one instead of adapting the whole project to the guess.

Quick Edit and Refactor provide a diff review. Agent approvals depend on the tool, active project rules, and Skip approval prompts setting; they are not a substitute for reviewing the final changes. Keep skip approvals off while learning the workflow and consult the Agent guide for the complete protection rules.

Follow-up after agreeing on the cause
Make the smallest fix for the confirmed pause-input issue.
Preserve the existing "pause" action, scene paths, and Resume signal connection.
Do not add a new menu system or rename unrelated nodes.
Explain each changed line and list the four gameplay checks to run.

How do I know the AI-assisted change worked?

Run the original checks, not just a new demonstration that avoids the failure. For the pause menu, open and close it twice, use both the input action and Resume, and confirm gameplay resumes at the same state. Inspect debugger output and the complete diff before keeping the change.

If a check fails, report the new evidence in the same focused conversation. Do not stack another speculative rewrite on top. Once it works, ask for a short explanation of why the fix works so the next similar problem is easier to solve yourself.

  • The original failure is gone and the normal path still works.
  • No unexpected files, input actions, dependencies, or credentials were introduced.
  • The behavior survives scene restart and repeated use.
  • You can explain the changed logic and recover the previous version.

Try this workflow inside Godot

Use GDSense to ask questions, attach the context you choose, and review proposed changes without leaving the editor.