Godot Engine: How to fix broken material dependencies in .escn files exported from Blender

This article is also available on Odysee.

Using the .escn exporter for Blender (wiki page, download) allows you to easily reuse materials for multiple meshes in Godot.

However, when you move or rename materials that are referenced by an .escn file (or a scene that contains an .escn file), the link to the material breaks and you see an error similar to this one:

How to fix these broken material dependencies

There are two ways to fix the dependencies. In either case make sure to first close the scene that contains a mesh with broken dependencies. Then perform either step 1 or 2.

Solution 1: Reexport the mesh

Go back to Blender. If you have renamed the material in Godot, update the material’s name in Blender accordingly. If you have only moved the material in Godot, you don’t need to perform any extra steps in Blender. Then open the export dialogue via File – Export – Godot Engine (.escn).

Make sure the Material Search Path uses the correct setting in Blender’s export dialogue. I always set it to Project Directory. Reexporting the mesh will search for existing materials with the names you have used in Blender and automatically fixes all paths.

You might need to reimport the mesh in Godot manually. To do so, select the .escn file in Godot, click on the Import tab and then click on the Reimport button at the bottom.

Solution 2: Fix the .escn file with a text editor

.escn is a plain text file format than can be easily opened with any text editor. You will see references to used materials at the very top. Here’s an example:

[gd_scene load_steps=1 format=2]

[ext_resource id=1 path="../Materials/Mat_Cube.tres" type="SpatialMaterial"]

[ext_resource id=2 path="../Materials/Mat_Sphere.tres" type="SpatialMaterial"]

[ext_resource id=3 path="../Materials/Mat_Cylinder.tres" type="SpatialMaterial"]

You can fix the path pointing to any material manually. After saving the file, switch back to Godot. Godot will instantly apply your changes and your materials should work again.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Nach oben scrollen