19

In Godot, when you import images and other assets into the editor, there's an additional <filename>.import file created.

What are those .import file used for? Should you commit them to your git repo?

PapaFreud
  • 3,636
  • 4
  • 34
  • 45

3 Answers3

30

Here's what the 3.0 docs say:

Importing will add an extra .import file, containing the import configuration. Make sure to commit these to your version control system!

And similarly the 4.0 docs say something very similar (emphasis theirs):

Importing will add an extra .import file next to the source file, containing the import configuration.

Make sure to commit these files to your version control system, as these files contain important metadata.

Search "godot import files" on Google should lead to these docs.

Jeroen
  • 60,696
  • 40
  • 206
  • 339
Lortet
  • 518
  • 4
  • 10
-1

Previous answer cites the Godot docs as important to commit to git but at these docs, if you read on, it is quickly dismissed as optional:

If any of the files present in this folder [.import] is erased (or the whole folder), the asset or assets will be reimported automatically. As such, committing this folder to the version control system is optional. It can save time on reimporting time when checking out in another computer, but it takes considerably more space and transfer time. Pick your poison!

When various assets are imported into the game they can have special options for ways to import that type of asset, such as filtering of a texture. These assets will have processing applied when imported into the game editor, the .import director, as an optimization for resource loading.

With Godot 4, the base folder has changed to ".godot"

If you have more then one import preset for a single type of asset, commit the import directory. If you don't care about how the asset is imported don't commit import directory.

https://docs.godotengine.org/en/stable/tutorials/assets_pipeline/import_process.html

I'm running a CI on a RaspberryPi4 and need to regenerate the import from a fresh clone of the repo. Trying to run scripts from the command line runs into issues because it cannot find various resources/assets for the game. This can be fixed by regenerating the .import directory. Many warnings from the command line before an the import say, "please run the project in the editor at least once". Simply opening the project will import all assets of the game.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33873144) – Jonathan Holvey Feb 24 '23 at 05:22
  • It does, but this is a very vague question – pennyloafers Feb 25 '23 at 13:08
  • The question was mainly about `.import` _files_, not the additional `.import` folder. Note that in [the 4.0 docs](https://docs.godotengine.org/en/4.0/tutorials/assets_pipeline/import_process.html#files-generated) advice has become a bit stronger towards _not_ committing that folder to version control either, and the default .gitignore and folder structure will also make that the default. – Jeroen Mar 14 '23 at 09:46
  • Thanks for pointing it out, but I read the opposite. Do commit the import because some assets can have many options and commiting the import you can save time fiddling with each asset. I think this can be mitigated with an import preset. But that only works if you can live with one preset. – pennyloafers Mar 15 '23 at 12:25
-6

Relax, just ignore. All the projects that I worked on godot never generated conflict without importing them. Also because each ".import" is unique from PC to PC.

  • 1
    "... Make sure to commit these to your version control system!" even without those ".imports", when you open Godot, will load everything you have "new" and done, can use normal. – Klaus Dellano Jan 20 '19 at 02:04