When cloning project from a Github repo all tilesets lose their data

Godot Version

4.2.2

Question

When I clone the repo of my godot project the tilesets lose access to their textures (despite those textures still being in the directory) and they lose any tileset data such as collision or their Z_Index. I have tried this with different versions of the same repo but the bug reproduces everytime.

I originally thought I might be experiencing the issue outlined in this post but following the “Fix” steps in that thread bore no fruit.

Everything works completely fine on my original copy of the project, making a manual copy works fine too, but the moment its cloned off github the tileset tres file loses all their data.

Heres a comparison of my build and a cloned build:

Normal Working Original Build

Clone off Github

Only working ““fix”” so far has been if I copy and paste the tres from the main build into the cloned repo but theoretically these files should be the same, right? I can’t even find a difference between them and this doesn’t even work 100% of the time.

Sorry if I havent provided enough details, I literally have zero clue what could be happening, Any help appreciated!

Have you tried reloading the project without saving anything after the first open? I’ve only seen this be helpful with plugins myself.

Are the tilesets saved as a resource themselves or only created in the scene?

Understandable if not, but could you post the github page?

Just tried reloading the project as you suggested and its still broken, also I believe the tilesets are saved as a resource, they have their own file? is that what you mean by that?
image

I can’t share the github page because the game is not publicly available yet sadly

1 Like

Yes thank you exactly what I was asking, might help with this next question.

Does git state any changes? Could you post that diff if any?

If you save, then discard the changes via git checkout main_tilset.tres does that fix the issue?

My best guess right now would be CRLF line endings shenanigans are affecting the tileset specifically, if it has a certain line-based format for parts of it’s data. Maybe saving it as a .res instead of .tres would fix this, or changing how you upload/checkout line endings to git. But this seems a little far fetched, I need more tests

Edit: looking at a tileset.tres format doesn’t seem like CRLF matters, especially for the Texture2D file. And this would have to affect every file.

Sorry to ignore a good chunk of this reply by restarting the editor 4 times in a row without saving actually ended up fixing it?? Your initial suggestion seems to have been the right track.

For the record though, Github showed no difference between the two files when I tried replacing it

Another wild guess if you are on windows: Is there another file with the same name but different capitalization i.e. “overworld_tiles.png” and “Overworld_Tiles.PNG”? Windows allows files with different capitalization but will only have one accessable, seemingly deciding which at random. You would have to check on github for these files.

4.2.2 tries to use unique ids in addition to filenames when finding resources, could be that windows will not allow Godot to recognize the real file capitalization.

No matching filenames from what I’m seeing

Might be worth trying saving your tileset as a .res (binary format)? Would help deduce if it’s loading the tileset wrong or loading the images wrong.

You aren’t .gitignore-ing the .import files right?

How would I convert my tileset to a .res ?

Also whats the issue with .gitignoring the .import files? It defaults to ignoring them when you make a repo and without them being ignored my repos always break like crazy

I usually right click them from the inspector and use “Save as…” again, but change the extension to .res

The import files are terribly important to kept in git. Your tileset can’t find the images because it doesn’t know how to import them the same way your colleages (or past self) have. It may generate a new uid that does not match what the tileset is looking for.

For example in 3D projects texture imports are changed when loaded as a material, if this information is not saved then copy the project will expand all texture sizes and remove mipmaps resulting in terrible disk usage and performance.

If it’s github’s default to ignore *.import then it’s a truely scary default. Godot’s “Project > Verision Control > Create Version Control Metadata” adds this as the .gitignore

# Godot 4+ specific ignores
.godot/

Changing the filetype to .res worked! I apparently didn’t actually have the import files ignored, they are all there in the repo I was just confused on the wording, thats my bad!

1 Like

Glad .res helps, Very strange though! Might look into this more…

1 Like