11
\$\begingroup\$

I'd like to see the changes made in a scene (.unity file) before I commit them to git.

I have looked into several GIT/Unity solutions but all of them are made for merging changes and not for showing a diff with last version.

The problem with scene files is that they use GUIDs that point to other assets and when I open a diff for a scene file I can't really make anything out of it.

For example: git diff

Instead, I'd like to see something like this: visual diff

Is there anything existing that does this?

\$\endgroup\$
  • \$\begingroup\$ I'm not 100% sure right now, so I'm not posting as an answer, but I think Sourcetree shows the diff. Provided you have set your project to text serialization. \$\endgroup\$ – Christian Mar 1 '17 at 12:09
  • 1
    \$\begingroup\$ During time I have just learned to watch the scene and prefab files themselves. Nowdays I can in somewhat enough accuracy tell that there's a brunett, blonde, a redhead... Git and Unity really has nothing to do with each other so either of them are probably not going to provide a tool like this. Unity wants to promote it's own collaboration cloud based thing. \$\endgroup\$ – Lasse Mar 1 '17 at 12:50
  • \$\begingroup\$ I might try to develop such a thing myself if there's no ready solution. \$\endgroup\$ – lilotop Mar 1 '17 at 13:45
  • 7
    \$\begingroup\$ Make it. Put it on the asset store. Profit. \$\endgroup\$ – MichaelHouse Mar 1 '17 at 18:02
  • 1
    \$\begingroup\$ @Lasse, actually, they are working on such a tool. I am pretty sure its in beta stages (i was invited to test it, but they are not exactly secretive about it). Id speculate it should be out within a month or two. \$\endgroup\$ – Gnemlock Mar 6 '17 at 4:58
1
\$\begingroup\$

I'd like to see the changes made in a scene (.unity file) before I commit them to git.

Any decent git tool will do this provided the scene file is not binary; but, as you mentioned, the GUID references makes it difficult to read. If the scene is binary, serialization may be updated in Edit -> Project Settings -> Editor -> Asset Serialization; but, be warned: data-loss may occur (See Draco18s comment below.).

I have looked into several GIT/Unity solutions but all of them are made for merging changes and not for showing a diff with last version.

Seeing the changes made to a single file is one of the core features of git log. In fact, there's a stackoverflow question on that. Basically you'd use something like

git log --follow path/to/scene.unity

to display the history of that file. Add -1 to display the most recent changes to the specified file. Ommit -1 and use -p to see the patch made for each commit that modified that file. I recommend reading through the stackoverflow question before touching the git-log documentation because it's very long.

Instead, I'd like to see something like this:

[scene graph diff]

Is there anything existing that does this?

As far as I can tell, No. That being said, Unity for Git appears to be the natural place to find it. Since it's in alpha, you should create an issue there to address this. Since it's unique to applying git diff on unity's intrinsic scene graphs, I suspect it'l be strongly relevant there.

\$\endgroup\$
  • \$\begingroup\$ Any decent git tool will do this ...provided the file isn't binary. Which can be set (Edit -> Project Settings -> Editor -> Asset Serialization). I've got two projects right now, one where the scene file is binary data and one where it's text. The text one was changed because of an asset I imported that encouraged changing to "Force Text" because of some aspect of the plugin/asset/target platform performed better. WARNING: changing modes can result in data loss. \$\endgroup\$ – Draco18s no longer trusts SE Jul 17 '17 at 19:03
-4
\$\begingroup\$

I would recommend you to just use Git with Bitbucket (as push origin !) as it provides a really nice GUI that lets you see graphical representation of your branch and commit history as well as changes within the text files where You can even see changes in the code in red and green plus many other nice workflow features.

\$\endgroup\$
  • \$\begingroup\$ I thing you totally misunderstood my question. I'm talking about text based scene files that contain guid references to other unity objects. Unless there's some kind of smart bitbucket client which I'm not aware of, that can resolve those references - you're totally off base here. \$\endgroup\$ – lilotop Mar 29 '17 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.