.gdignore file vs .folder_name to hide folder

Godot Version

4.4 Beta 3

Question

So for a while I’ve been hiding folders by adding a period at the beginning because I saw the .godot folder do it. Just now though, I found out about .gdignore (which also shows up in that .godot folder).

Only adding a . to the folder name seemed to work fine so I wanted to know if there was a difference between the two, but I only find stuff about the .gdignore file so I thought I’d ask here.

The .godot “hidden” folder contains project specific configurations for the current compiled project and editor session pertaining to that project.

The .gdignore “hidden” file is for ignoring folders that you don’t want parsed in the res:// folder. Effectively hiding any assets etc. from the Godot Editor.

The . is just a way operating systems handle hidden file/folder preferences.

1 Like

A leading dot means the file/folder should be hidden, at least on macos/linux systems. In this case “hidden” means it’s still accessable, with another hoop to jump through, i.e. using ls -A instead of ls, or selecting “show hidden files” in a file manager. This is usually to organize system files out of sight, otherwise they are regular files/folders.

.gdignore is also a hidden file that tell Godot to avoid accessing the parent folder, and it will not import anything inside a .gdignore’d folder, the folder will not show in Godot’s Filesystem panel.

1 Like

I’m a bit confused because having a .hidden folder with or without a .gdignore file inside both:
-hide the folder from Godot’s file system
-don’t seem to import automatically
-still allow me to load them via code (albeit without autocomplete) with

var hidden_text = preload("res://.hidden/fake_color.tres")

So can I just keep using the .folder_name method without .gdignore file?

Yes you can keep using the leading dot to hide files/folders, though if you are using them in Godot it shouldn’t be hidden or it won’t be included in the exported project either.

.gdignore is particularly useful when you have a folder keeping source assets within the project directory, like blend files that must be exported before making it into Godot. Anything that should be in the project, but not in Godot.

1 Like

Right, that’s exactly what I’m using them for, stuff like reference material and third party project files so that’s good!

Thanks a lot!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.