Search Unity

GUID changes

Discussion in 'Editor & General Support' started by WalterTamboer, Apr 30, 2014.

  1. WalterTamboer

    WalterTamboer

    Joined:
    Apr 14, 2013
    Posts:
    3
    Hello,

    We have some very weird problems with some of the GUID's of our assets. Our assets (scripts, prefabs, etc.) are stored in Git. The meta files of those assets are also stored in Git. For some reason the GUID's in some meta files (just one or two files) are constantly changed causing references to break between different computers.

    My questions are:
    • Why are GUID's changed once they are generated already?
    • How are GUID's generated?
    Everybody in the team has a pro license but only some of us have a Flash license. We are working on Windows 7 machines.

    Thanks!
     
    Last edited: Apr 30, 2014
    dan_ginovker and Whatever560 like this.
  2. WalterTamboer

    WalterTamboer

    Joined:
    Apr 14, 2013
    Posts:
    3
    I have made a screenshot of what's going on:

    $guid-change.png
     
    Petr777 and sj631 like this.
  3. WalterTamboer

    WalterTamboer

    Joined:
    Apr 14, 2013
    Posts:
    3
    Does anyone have an idea?
     
  4. fairchild670

    fairchild670

    Joined:
    Dec 3, 2012
    Posts:
    69
    Is the issue just that the meta files are changed? Might be best to update Git to ignore them (that's what I've been doing). I suspect the GUIDs in the meta files are specifically for use by the editor and nothing runtime related - so would be good to know what's going on, but shouldn't hamper development.
     
  5. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    It is how assets are referenced, which is why your links are breaking. You could ignore them, but that can cause problems as well, as many assets store their information in the meta files. (textures, imported data, sprites, etc...). Typically you should commit your meta files with each commit. My guess would be someone is probably not committing them or ignoring them. If someone on your team commits an asset without committing the meta, it usually breaks when others pull. The main thing is that everyone consistently does the same thing however you handle it.
     
  6. MrXee

    MrXee

    Joined:
    Jan 20, 2014
    Posts:
    7
    We're also having an issue where a .unity scene is referencing a font GUID on one PC that is different on another PC. When I load my colleague's scene on my PC, all the text is missing but on his PC, it's not. I tried deleting my font.otf.meta file and I got {5395a16793424cd4fba282896a9da9eb} as GUID while deleting on his PC gives {b6a71c3326983cc4fbb36b9415fc0b76} for the same meta file. The scene's font GUID is the same GUID as the one that gets recalculated on his PC.

    I also tried using AssetDatabase.GUIDToAssetPath to get the asset path of his GUID and it returns nothing.

    The only difference I'm seeing is that I have Unity v4.3.4f1 and he has 4.3.2f1 ...

    FYI: We're using the perforce integration inside of Unity. Not git. We also commit our meta files to perforce.
     
  7. Giometric

    Giometric

    Joined:
    Dec 20, 2011
    Posts:
    170
    Seconding this (emphasis mine). My team had a similar issue and this was the problem, every time. The scenario goes something like this:

    User 1 adds a texture file to the Unity project on their computer, let's call it texture.png. User 1 tabs back to Unity.

    Since it is a new asset, Unity on User 1's computer creates texture.png.meta file. The GUID is 123.

    Everything looks good, so User 1 commits texture.png to SVN, but forgets to commit the accompanying *.meta file.

    User 2 does an SVN Update. texture.png is now added to their project (but no *.meta file).

    User 2 tabs back to Unity. When they do, texture shows up and looks fine. But, in the background, Unity has (silently) checked for a texture.png.meta file, found that it doesn't exist, and created a brand new one. The GUID in this new file is 456.

    User 2 creates a new Material, using texture.png, then adds and commits this new material to SVN.

    At this point User 1 and User 2 have two completely different versions of texture.png.meta. To Unity, this is essentially the same as them having two totally different assets. The Material User 2 created looks for a texture with the GUID 456, which does not exist on User 1's computer, and so when User 1 does an update and gets that material, it will appear broken on their computer. If User 1 then 'fixes' the material to reference texture.png (which will then have the material looking for a texture with GUID 123 ) and commits it, then it will be broken on User 2's computer. Then User 2 fixes it on their end, it breaks for User 1 again, and so on.

    Fixing one busted texture/material isn't a big deal, but it can get messy fast when you have different people working on different things, and somewhere along the line a .meta file or two or ten was forgotten, and now there's dozens of broken materials and the scene only looks right on User 5's computer and is broken everywhere else, etc.

    The example GUIDs used are of course not realistic, Unity's are much longer and have letters in them, etc. But this can happen for pretty much any asset type and with any version control. Git should be somewhat safer as long as you don't put *.meta in the .gitignore file, but you say that the *.meta files were in there. By any chance, is the GUID swapping between the same few values? If it is, my scenario above could be the culprit; multiple users are repeatedly overwriting each other's .meta files with the GUID that their own copy of Unity created, which occurred in the first place because the first person to add the file somehow added it without the .meta file (maybe they did a commit before tabbing back to Unity to let it import).
     
  8. sj631

    sj631

    Joined:
    Dec 23, 2016
    Posts:
    22
    try discarding the new .meta files which are automatically generated by unity for assets which were previously commited.
     
  9. Sompol_Rznet

    Sompol_Rznet

    Joined:
    Sep 14, 2018
    Posts:
    22
    I met more weird problem.

    Out artist already commit their asset and together with its meta file.

    But yet, Unity keep changing that meta file guid when we open Unity Editor on another PC.

    Anyone have an idea to fixing these ? Or know why Unity changing guid while it's already have meta file.

    PS. Unity 2020.3.22f1
     
    Whatever560 likes this.
  10. Sompol_Rznet

    Sompol_Rznet

    Joined:
    Sep 14, 2018
    Posts:
    22
    Ahh... the case closed.
    In my case, it is GUID duplication problem.
    Look like they move assets. But forget to commit a deletion side. (When moving or changing any file path, SVN will detect it as the old path got deleted and the new path is added).
     
    Changemoon7 likes this.
  11. unity_BB192A307AE85F9CE622

    unity_BB192A307AE85F9CE622

    Joined:
    Oct 7, 2021
    Posts:
    1
    not sure why, I've expecience the problem after manually renaming the files (f01 to f00, f02 to f01, ..), but not commiting the changes in LFS. It looks like git did swap the local files, and Unity kept "correcting" their GUIDs, effectively breaking the references. The fix was to simply delete the files from Unity and discard the unstaged changes. Upon being restored everything works fine.
     
  12. TheQwertz

    TheQwertz

    Joined:
    May 31, 2022
    Posts:
    2
    I'm having the same problem of guids changing, but I'm not using any sort of version control and I'm not changing the meta files. Any idea what could be going on?