Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Best practice how to handle LightingData.asset in Git?

Discussion in 'Editor & General Support' started by TomasRiker, Jul 26, 2019.

  1. TomasRiker

    TomasRiker

    Joined:
    Jan 26, 2012
    Posts:
    48
    Hi,

    I'm trying to keep everything out of my Git repository that can be built locally. That includes baked lighting data (basically all the files in a scene's sub-folder: LightingData.asset, LightingData.asset.meta, light maps, reflection probes).

    Now there's a problem with that: Somebody clones the repository. Since the lighting data is not cloned, he has to build it himself. Now each developer will have his own LightingData.asset file with a different GUID. Since the scene file references the lighting data by its GUID, every change to the scene committed will change the GUID for all the other developers too, who will then have a scene that references a non-existing GUID.

    Ideally, Unity would use the GUID that's already stored in the scene file (to reference the lighting data) when a new LightingData.asset is created. But instead it gets a new random GUID.

    Any ideas how this can be handled nicely without committing the LightingData.asset file to the repository? I already tried having only the .meta file in the repository, hoping that Unity would use the GUID stored in there, but that didn't work.
     
    Last edited: Jul 26, 2019
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    1,942
    Git LFS, and upload it there.
    I don't think there's another option, if you want for the lighting data to be present (upon cloning).
     
  3. TomasRiker

    TomasRiker

    Joined:
    Jan 26, 2012
    Posts:
    48
    Thanks. I have heard of Git LFS. I don't necessarily want to have lighting data after cloning a repository. It would be perfectly fine for me to have the user build lighting data locally. The only problem I'm having is that this will change the referenced GUID in the scene and then there will be conflicts all the time because different developers have different GUIDs for their lighting data.
     
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    1,942
    Disable lighting auto-generation. Its inside lighting settings.
     
  5. TomasRiker

    TomasRiker

    Joined:
    Jan 26, 2012
    Posts:
    48
    It is disabled. The point is that when lighting data is re-generated (manually or automatically, it doesn't matter), it will get a new GUID, and that GUID will be referenced in the scene file, which is in the repository. So each time I commit a change to the scene, the other developers will get the reference to my GUID, which doesn't exist on their machine.
     
  6. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    33
    Curious about this myself.