Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Prefab loses script reference after updating project from source control

Discussion in 'Prefabs' started by mfs28112, Dec 6, 2022.

  1. mfs28112

    mfs28112

    Joined:
    Dec 23, 2021
    Posts:
    8
    Hello,

    I added a prefab to my project. There is one script on it. I use SVN for version control. I versioned both the prefab and script, added instances of the prefab to my scene, and committed all my changes. I work on this project on two PCs, one in the office and one at home.

    Now here's the problem: Whenever I commit changes to the project on one PC, then update (pull) the changes into my local copy on the other PC, the prefab's script is marked "missing" on the PC pulling the changes. I have to manually add it back, then have to re-add all the references to the serialized fields in the script. I commit these changes, pull the changes on the first PC, it's broken there, rinse and repeat. I am not sure why this is happening, does anyone have an idea? I am using Unity 2020.3.23f1.

    I also have a mesh in my scene (unrelated to the prefab) whose material becomes detached every time I pull changes.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    Sounds like you did not add (all) the .meta files to version control.

    Be sure to use an appropriate svn-equivalent of .gitignore. I guess there must be some (up to date) ignore list templates around even for … archaic version control systems like svn. :D
     
    mfs28112 likes this.
  3. mfs28112

    mfs28112

    Joined:
    Dec 23, 2021
    Posts:
    8
    Thanks, that solved the problem.