Search Unity

Unity and Git: Missing Sprites and Scripts

Discussion in 'Editor & General Support' started by dasmit, Jan 22, 2014.

  1. dasmit

    dasmit

    Joined:
    Jan 22, 2014
    Posts:
    3
    I'm trying to use git/github with my Unity projects to ease working on separate computers (I'm the only developer). I followed the instructions found here. It tells you to go to Project Settings, set Version Control to 'Visible Meta Files' and Asset Serialization to 'Force Text'. Also adding some .gitignore properties for things like the Temp and Library directories.

    I'm working with Unity 4.3's new 2D features (free version). When I pull down committed code, my Game Objects are missing their Sprites and Scripts. Everything else seems to be intact.

    I looked at the diffs before committing and it seems that the Assets have different GUIDs on different computers. Would this cause my issue? How would I fix the issue? Any help is much appreciated.

    Here is the .gitignore
    Code (csharp):
    1.  
    2. # =============== #
    3. # Unity generated #
    4. # =============== #
    5. Temp/
    6. Obj/
    7. UnityGenerated/
    8. Library/
    9.  
    10. # ===================================== #
    11. # Visual Studio / MonoDevelop generated #
    12. # ===================================== #
    13. ExportedObj/
    14. *.svd
    15. *.userprefs
    16. *.csproj
    17. *.pidb
    18. *.suo
    19. *.sln
    20. *.user
    21. *.unityproj
    22. *.booproj
    23.  
    24. # ============ #
    25. # OS generated #
    26. # ============ #
    27. .DS_Store
    28. .DS_Store?
    29. ._*
    30. .Spotlight-V100
    31. .Trashes
    32. Icon?
    33. ehthumbs.db
    34. Thumbs.db
    35.  
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Yes, different guid's usually cause Unity to not find the references to that particular asset or to mix up things. You need to commit the .meta files for every asset to the repository, so you have the same .meta file on every computer. The .meta file contains the guid for a particular asset.
     
  3. dasmit

    dasmit

    Joined:
    Jan 22, 2014
    Posts:
    3
    Thank you Peter! I realized I only appended the above .gitignore to the default. So it was ignoring my meta files. I can't test if this fixed the issue until after work when I test it on my home PC, but either way that was good information. Thanks!
     
  4. dasmit

    dasmit

    Joined:
    Jan 22, 2014
    Posts:
    3
    This has fixed my issue. Thanks Peter!
     
  5. dmitryon

    dmitryon

    Joined:
    Jan 6, 2018
    Posts:
    9
    Since this is still the first result when you google the issue, I'm gonna have to necro it. Sorry.

    I just had this issue. It's a sensitive one for me, because I'm working on a UI project, and when all sprites and fonts become missing it kind of a start from scratch aka 5+ hours of redundant work for me.

    I believe I know what the issue was, as I was able to fix it within' 20 minutes.

    I work between Mac and PC developer platforms using Git. While working on Mac I had to emergency commit and push while having compile errors in the script. I was planning to fix them on PC.

    When pulling and opening Unity on PC what happened is Unity started complain about inability to proceed due to compile errors in one of the scripts. My guess is that at that point Unity gave a priority to that and did not finish establishing meta links properly. So even after fixing those errors unity prefabs and game object all had missing sprites and fonts. Naturally, links to scripts were not missing, because those were established first which then lead to compile errors messages and - my guess - termination of further linking process.

    The fix was simple: revert to the last pulled commit, opening script editor instead of unity,fixing compile errors and then opening unity. Now all the linking process was not stopped by the compile errors discovery and was successfully completed.
     
    egor_shem likes this.
  6. D12294

    D12294

    Joined:
    Oct 6, 2020
    Posts:
    81
    enzoBro likes this.