Search Unity

scene versioning using git

Discussion in 'General Discussion' started by Epic_Cube, Nov 8, 2021.

  1. Epic_Cube

    Epic_Cube

    Joined:
    Jul 3, 2012
    Posts:
    100
    Hi all,
    I've used for a lot of time Unity collaborate for versioning and sharing of the projects with my colleagues but now we have migrated to git.
    Git is fine for code versioning but we are finding some difficulties for versioning of Unity assets like scenes.
    Merging the code is quite simple but if 2 peoples have to modify something in the scene, merging is quite complex (a single game object with a number of components should contain a lot of lines to be merged).


    How do you face this problem?

    thank you
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Basically you do not do that using git. Because while scenes are text, they're basically more like binary blob. So if you have a version conflict, this is not going to be easy to resolve it.

    People can work on smaller scenes, or they can work on prefabs.

    I also think that unity worked on "Collaborate" to address that, but I have no experience with it.
     
  3. Epic_Cube

    Epic_Cube

    Joined:
    Jul 3, 2012
    Posts:
    100
    Yes, you're right.
    But imagine that we are working on a project. I change a single value of a component on a non-prefab object, and then I commit and push this change. If you changed that value too, there's a conflict.
    I know that you can lock some files to avoid collisions, but... is there a simpler way to avoid that?
     
  4. kittik

    kittik

    Joined:
    Mar 6, 2015
    Posts:
    565
    In the teams I have worked in, the general rule is to avoid pushing scenes unless you have communicated ownership of that scene. If someone else pushes changes to an owned scenes will not be able to keep any of their changes.

    Use additive scenes, or rely more on prefabs to avoid multiple people wanting the same scene at once.
     
  5. Epic_Cube

    Epic_Cube

    Joined:
    Jul 3, 2012
    Posts:
    100
    I thank @kittik and @neginfinity for the tips. Anyone knows if exists an editor tool or extension that allow to detect differences like the prefabs and allow to apply or discard single changes?
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,676
    Joe-Censored likes this.
  7. Epic_Cube

    Epic_Cube

    Joined:
    Jul 3, 2012
    Posts:
    100
    sounds great! I'll check it! Thank you