Posted on February 15, 2024 | #gamedev, #godot

thumbnail

Force refresh Godot's file system inspector

I’m working on an editor plugin for managing Resources. You are able to create Resource instances with it, which are saved into generated directories with adequate structure.

The thing is, sometimes it takes Godot a pretty long time to refresh its filesystem inspector. I think the editor does it somewhat periodically, because if you leave it alone, the change shows up eventually. But we can force this refresh just in one line of code:

EditorInterface.get_resource_filesystem().scan()

You could see the answer to this problem from the thumbnail of this post :) Check out the scan method in docs.

Out of courtesy, you could check if the filesystem isn’t currently scanning before you order it to refresh again.

var fs = EditorInterface.get_resource_filesystem()
if fs.is_scanning():
	fs.scan()