Skip to content

Resources

Create and modify Godot resources — the building blocks that nodes reference.

Resources in Godot are data objects separate from the scene tree: PhysicsMaterial, StandardMaterial3D, BoxShape3D, CapsuleShape3D, AudioStream, and hundreds more. Nodes hold references to resources; Director can create and configure those resources.

Operations

resource_read

Read properties from an existing saved resource.

json
{
  "op": "resource_read",
  "project_path": "/home/user/my-game",
  "path": "assets/materials/enemy_red.tres",
  "properties": ["albedo_color", "roughness", "metallic"]
}
ParameterTypeRequiredDescription
depthnumber optional
default: 1
Depth for nested resource serialization. At depth 0, nested resources are returned as path strings. At depth 1 (default), top-level properties are serialized but nested resources within them are paths. Higher depths recurse.
project_pathstringrequiredAbsolute path to the Godot project directory.
resource_pathstringrequiredResource file to read (relative to project, e.g. "materials/ground.tres").

Response:

json
{
  "op": "resource_read",
  "path": "assets/materials/enemy_red.tres",
  "properties": {
    "albedo_color": [1.0, 0.0, 0.0, 1.0],
    "roughness": 0.7,
    "metallic": 0.0
  }
}

material_create

Create a new material resource and save it to disk.

json
{
  "op": "material_create",
  "project_path": "/home/user/my-game",
  "material_type": "StandardMaterial3D",
  "properties": {
    "albedo_color": [0.8, 0.2, 0.2, 1.0],
    "roughness": 0.7,
    "metallic": 0.0
  },
  "save_path": "assets/materials/enemy_red.tres"
}
ParameterTypeRequiredDescription
material_typestringrequiredMaterial class name. Common types: StandardMaterial3D, ORMMaterial3D, ShaderMaterial, CanvasItemMaterial, ParticleProcessMaterial. Any ClassDB Material subclass is accepted.
project_pathstringrequiredAbsolute path to the Godot project directory.
propertiesobject optional
default: null
Optional properties to set on the material after creation. Type conversion is automatic (Color from "#ff0000" or {"r":1,"g":0,"b":0}).
resource_pathstringrequiredSave path for the material relative to project (e.g. "materials/ground.tres").
shader_pathstring optional
default: null
For ShaderMaterial: path to a .gdshader file (relative to project). Loaded and assigned as the shader property.

Response:

json
{
  "op": "material_create",
  "save_path": "assets/materials/enemy_red.tres",
  "result": "ok"
}

shape_create

Create a collision shape resource.

json
{
  "op": "shape_create",
  "project_path": "/home/user/my-game",
  "shape_type": "BoxShape3D",
  "properties": {
    "size": [2.0, 1.0, 2.0]
  },
  "save_path": "assets/shapes/platform_box.tres"
}
ParameterTypeRequiredDescription
node_pathstring optional
default: null
Path to the CollisionShape node within the scene tree. Required when scene_path is set.
project_pathstringrequiredAbsolute path to the Godot project directory.
save_pathstring optional
default: null
Save the shape as a .tres file at this path (relative to project).
scene_pathstring optional
default: null
Attach the shape to a CollisionShape2D/3D node in a scene. Requires scene_path and node_path to also be set. The shape is assigned to the node's "shape" property.
shape_paramsobject optional
default: null
Shape configuration. Keys are property names on the shape resource (e.g. "radius", "size", "height"). Type conversion is automatic.
shape_typestringrequiredShape class name. 3D: BoxShape3D, SphereShape3D, CapsuleShape3D, CylinderShape3D, ConcavePolygonShape3D, ConvexPolygonShape3D, WorldBoundaryShape3D, SeparationRayShape3D, HeightMapShape3D. 2D: CircleShape2D, RectangleShape2D, CapsuleShape2D, SegmentShape2D, ConvexPolygonShape2D, ConcavePolygonShape2D, WorldBoundaryShape2D, SeparationRayShape2D.

style_box_create

Create a StyleBox resource (used by UI controls).

json
{
  "op": "style_box_create",
  "project_path": "/home/user/my-game",
  "style_type": "StyleBoxFlat",
  "properties": {
    "bg_color": [0.1, 0.1, 0.2, 1.0],
    "border_width_top": 2,
    "border_color": [0.5, 0.5, 1.0, 1.0]
  },
  "save_path": "assets/ui/panel_style.tres"
}
ParameterTypeRequiredDescription
project_pathstringrequiredAbsolute path to the Godot project directory.
propertiesobject optional
default: null
Optional properties to set on the StyleBox after creation.
resource_pathstringrequiredSave path for the StyleBox relative to project (e.g. "ui/panel.tres").
style_typestringrequiredStyleBox class name: StyleBoxFlat, StyleBoxTexture, StyleBoxLine, or StyleBoxEmpty.

resource_duplicate

Duplicate an existing resource file.

json
{
  "op": "resource_duplicate",
  "project_path": "/home/user/my-game",
  "source_path": "assets/materials/enemy_red.tres",
  "dest_path": "assets/materials/enemy_blue.tres"
}
ParameterTypeRequiredDescription
deep_copyboolean optional
default: null
Deep copy sub-resources (making them independent). Default: false (shallow copy — sub-resources are shared references).
dest_pathstringrequiredPath where the duplicate will be saved (relative to project).
project_pathstringrequiredAbsolute path to the Godot project directory.
property_overridesobject optional
default: null
Property overrides to apply after duplication. Keys are property names.
source_pathstringrequiredPath to the source resource file (relative to project).

Response:

json
{
  "op": "resource_duplicate",
  "source_path": "assets/materials/enemy_red.tres",
  "dest_path": "assets/materials/enemy_blue.tres",
  "result": "ok"
}

Common resource types

Shape resources

Used by CollisionShape3D and CollisionPolygon3D:

json
{ "type": "BoxShape3D", "properties": { "size": [2.0, 1.0, 2.0] } }
{ "type": "SphereShape3D", "properties": { "radius": 0.5 } }
{ "type": "CapsuleShape3D", "properties": { "radius": 0.4, "height": 1.8 } }
{ "type": "CylinderShape3D", "properties": { "radius": 0.5, "height": 2.0 } }

Physics materials

Used by PhysicsBody3D for surface friction/bounce:

json
{
  "type": "PhysicsMaterial",
  "properties": {
    "friction": 0.8,
    "rough": true,
    "bounce": 0.1,
    "absorbent": false
  }
}

Standard materials

Used by MeshInstance3D.material_override or surface materials:

json
{
  "type": "StandardMaterial3D",
  "properties": {
    "albedo_color": [0.2, 0.4, 0.8, 1.0],
    "roughness": 0.5,
    "metallic": 0.3,
    "normal_enabled": true
  }
}

Example conversation

Create a bouncy physics material for the player and assign it.
PhysicsMaterial created and saved at assets/physics/player_bouncy.tres. Assigning to the player.
Done. Player now uses the bouncy physics material (bounce=0.8, friction=0.3). Run the game to test.

Tips

Save resources when they will be reused. A saved .tres file can be referenced by multiple scenes — better for shared materials, shapes, etc.

Read before modifying. Use resource_read to check current property values before creating or duplicating resources.

Use resource_duplicate to create variants. Duplicate an existing material, then use node_set_properties to update specific properties — faster than creating from scratch.

Open source under the MIT License.