1
\$\begingroup\$

So, here is my problem.

First I have a look at the changes in the repository which I am working with.

Initially there are no changes:

enter image description here

Then I open up Unity, i don't make any changes and just save the scene:

enter image description here

I then go to GitHub Desktop and suddenly there are a lot of changes appearing which I did not make:

enter image description here

How can I avoid that?

The files which are getting changed are .prefab files.

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ Have you committed and fetched at least once? \$\endgroup\$
    – user100681
    Dec 3, 2017 at 12:55
  • \$\begingroup\$ @GabrieleVierti, yes I did. \$\endgroup\$ Dec 3, 2017 at 13:06
  • \$\begingroup\$ @GabrieleVierti, every time I need to commit I have to go through all that unnecessary changes and chose and commit only those that were generated by me. \$\endgroup\$ Dec 3, 2017 at 13:07
  • \$\begingroup\$ @GabrieleVierti, and there are seems to appear more and more changes after saving scene. I mean every time I commit then the next time I save scene there a few more unknown changes. \$\endgroup\$ Dec 3, 2017 at 13:08

1 Answer 1

1
\$\begingroup\$

Short answer:

Those changes seem to be of .meta file contents, and/or scene stuff [Update: As pointed out in the comments, they seem to be prefab data. But the issue and solution are the same]. It's not unthinkable that some floats will have the least significant bits changed due to floating-point precision errors. You can just ignore the fact that those changes exist, and commit them.


Slightly longer answer:

Don't worry... A position or rotation changed by 1e-6 (0.000001; BTW, yours are, like, 1e-12+ [0.000000000001]) is not going to have any noticeable difference in most games (in fact, unity considers anything with difference under 1e-5 as "equal", if you look at the source code). Your game would need to be a game like KSP trying to shoot something across the solar-system to hit a relatively tiny target in order for those to make a noticeable difference. =D


Bonus:

Since you seem to be unaware of the concept of FPPEs (floating-point precision errors), I will strongly recommend you to take a look at What Every Programmer Should Know About Floating-Point Arithmetic

\$\endgroup\$
12
  • 1
    \$\begingroup\$ I would not commit those because they'll clutter up the history and make it harder to spot the real changes. \$\endgroup\$
    – user253751
    Dec 3, 2017 at 22:08
  • \$\begingroup\$ @immibis Well, you don't get much of a choice; .meta files are necessary for the project to work correctly, AFAIK; not committing those would mean that your remote repo does not represent the same as your local repo(s), breaking the primary purpose of having version-control in the first place, and then, even if that wasn't the case, it would give you hell later and/or when working on teams. This is why, basically, all VCS tutorials on unity tell you to configure unity so that it makes .meta files plain-text, so that VCS can work with them easily (because you need to commit them). \$\endgroup\$ Dec 3, 2017 at 22:50
  • \$\begingroup\$ You don't commit files, you commit changes. I would not commit those changes. The specific changes mentioned in the question are: moving object positions on the order of 10^-6. \$\endgroup\$
    – user253751
    Dec 3, 2017 at 23:04
  • \$\begingroup\$ @immibis I meant that you can't .ignore the files, and exactly because the changes are 1e-6, and will have no noticeable result in-game, you're better off just committing them. --- If you want to waste effort on reviewing which changes to commit and which not to, I can't understand the logic in that, but do whatever you feel like. 🤷 (BTW, about "moving objects in the order of 1e-6, that's not the question, that's my answer) \$\endgroup\$ Dec 3, 2017 at 23:13
  • 1
    \$\begingroup\$ I do not see a solution actually... \$\endgroup\$ Dec 4, 2017 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .