Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question about where unity stores which script is attached to which object/prefab

Discussion in 'Editor & General Support' started by Taelsin, Jan 15, 2015.

  1. Taelsin

    Taelsin

    Joined:
    Jan 14, 2015
    Posts:
    1
    The reason I ask this is because I'm attempting to use git as the mode of source control for Unity 4.6.1. So far it has worked wonderfully, but when I clone the repository on a new computer and load up the particular scene, all of my prefabs and game objects have lost their attached scripts, but they do list that they are missing a script and the scripts still exist untouched. I merely need to reattach them to the game objects and prefabs and my scene runs perfectly. Currently I have the Library, Temp, and Build directories in my .gitignore file. Is it possible to save these associations through git?
     
  2. artefacto-sas

    artefacto-sas

    Joined:
    Mar 13, 2014
    Posts:
    11
    Hello,

    I think we are facing the same problem :

    We are using Unity Pro (4.6.1p5) and a SVN server to backup our source code. We have a problem with one of our projects : When we check out sources on some computers, Unity looses scripts on some of our game objects. We have followed these steps to setup SVN . Library folder is not ignored in SVN Repository.

    The problem :
    * All is ok on computer A. We commit source code.
    * We checkout source code on computer B and open Unity => Scripts are missing on game objects
    * We checkout source code on computer B and copy Library folder from computer A to computer B => All is ok.
    * Then if we execute « Sync Monodevelop Project » on computer B, we loose the links again.

    Is there a way to get correct sources from computer A (to computer B) from SVN ? Does anyone know how to clean Library folder dependencies on computer A ?
     
  3. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,613
    The correct set-up for source control is in the manual, but the key points are:

    1. Turn on 'Visible Meta Files' for your project via Edit -> Project Settings -> Editor.
    2. Add the Assets and ProjectSettings folders to source control. Do not add the Library or Temp folders to source control.
     
  4. artefacto-sas

    artefacto-sas

    Joined:
    Mar 13, 2014
    Posts:
    11
    Hi superpig,

    Thank you for your reply.
    The SVN setup is correct and we followed the user manual to init the repository.

    When checking out SVN and opening project on a computer we get theses lines in Editor.log :

    ----- Compute hash(es) for 965 asset(s).
    *** cb9a55ace3ab1294888ff254767a700c replaces d5371920d7901a7439215a5d9e902208 at path assets/classes/applicationdatamanager.cs
    *** f2e3bf15e02130842aa9118c93ecaf27 replaces cfea89ec01670ac42af477dbaeccbd99 at path assets/classes/parametercontrol.cs
    ....

    Could this be the problem when computing links from game objects to scripts ?

    Best,
     
  5. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,613
    I think that means that you've had one project clobber another project's generated GUIDs for those files - it's saying that the GUID in Library for "assets/classes/applicationdatamanager.cs" was recorded as being "d5371920d7901a7439215a5d9e902208", but it's now detected that the GUID should be "cb9a55ace3ab1294888ff254767a700c" instead, presumably because that's what it says in "assets/classes/applicationdatamanager.cs.meta". You should confirm that's what is in the .meta file.

    You shouldn't be seeing this every single time the project is launched, though. That suggests that the Library files are not being written to correctly for some reason.
     
  6. artefacto-sas

    artefacto-sas

    Joined:
    Mar 13, 2014
    Posts:
    11
    On the SVN, the meta file for applicationdatamanager.cs is "guid: cb9a55ace3ab1294888ff254767a700c".
    Isn't the meta correct ?

    Full meta file content :
    fileFormatVersion: 2
    guid: cb9a55ace3ab1294888ff254767a700c
    MonoImporter:
    serializedVersion: 2
    defaultReferences: []
    executionOrder: 0
    icon: {instanceID: 0}
    userData: