Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Prefab links keep getting dumped on Git pull

Discussion in 'Editor & General Support' started by bbvrdev, Mar 18, 2019.

  1. bbvrdev

    bbvrdev

    Joined:
    Aug 11, 2009
    Posts:
    221
    Hey Unity Community,

    We have a pretty massive codebase with a handful of developers all committing to it. One of the things that keeps coming up in our regression tests is a broken prefab link in one of our main game objects. We've fixed it many times and committed the change, validated it being fixed on the build computer, but we keep discovering that link broken again a few days later.

    Unfortunately that broken link causes our session saving class to fail, so it's somewhat critical. Seems lame to have to resort to Resources.Load because the same link keeps getting broken over and over!

    We have a similar issue where one of our characters keeps reverting to the default layer, which breaks his functionality.

    Any ideas what might be causing these kind of reversions?
     
    ben-rasooli likes this.
  2. Beastehs

    Beastehs

    Joined:
    Sep 8, 2018
    Posts:
    1
    did you ever find a fix for this?
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,071
    There really isn't any fix because git works perfectly with Unity when configured properly.

    Best practices involve saving your work and closing Unity before using git.

    But if you understand how Unity does and does not flush changes to disk (or at least ALWAYS do a save-project), you can get away with leaving Unity open.

    The only thing linking EVERYTHING together in Unity is the GUID assigned to a script or asset. Name is irrelevant. Only the GUID connects it. This GUID is in the meta file.

    If you fail to commit metafiles to git, you will never be able to work in Unity. 100% of all meta files and all changes to all meta files must be committed along with the work that triggered it, no exceptions.

    In your ProjectSettings, these two things MUST be correct for git:

    git_part_1.png git_part_2.png
     
    Last edited: Oct 21, 2021
    kodisz and Charlicopter like this.
  4. Pnvanol

    Pnvanol

    Joined:
    Jan 11, 2016
    Posts:
    127
    when forcing text still prefabs and scene changes are not being displayed in git, it says it is a binary file, is that normal?