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 Is it generally a good idea to add ProjectSettings.asset to your git ignore?

Discussion in 'General Discussion' started by IntoTheSoul, Jul 10, 2023.

  1. IntoTheSoul

    IntoTheSoul

    Joined:
    Oct 31, 2018
    Posts:
    29
    I want to be able to have certain conditions whenever i'm working on my own branch such as setting up a pseudo environment using Conditional Compilation. I am able to achieve this if i add the projectsettings.asset in my gitignore so that other team members wont be affected.
     
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,900
    No, it's not. Project Settings is intended for per project basis. It contains things should be the same no matter who works on the project. It is a very bad idea to ignore it and it will lead to build or test the project with the wrong settings and last minute fast fixing trips down the sweaty stressed out road. It is also a very bad idea to have significant different code to be compiled for developers. It will lead to code parts no one checks on for a long time and you know the sweaty trip on stress-lane...
     
    mahdi_jeddi and frosted like this.
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,503
    It depends on what you mean by "gitignore". If you mean the .gitignore file in your repo I'd suggest it's not a great idea because it's easy to accidentally commit it, and then it will affect others in your team. Oops!

    But git's ignore configuration is multi-layered and allows Personal Git ignore rules via .git/info/exclude, so I'd put them in there.

    I do echo Ninja's caution about minimising discrepancies between what code is being used by who and when (whether this is by conditional compilation or any other avenue). However, "minimise" does not necessarily mean "eliminate", so as long as the relevant gotchas are being managed I certainly wouldn't rule out that approach. What I would do is make sure that it's well documented and communicated to the team, and that the potential issues are discussed and properly handled.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    The way to go about this is to REVERT the changes you don’t want the rest if the team affected by before merging your branch into the mainline.

    Ideally there should be a code review, at the very least by you meaning: when you prepare the merge you look at each individual file’s changes and go over it to verify you aren’t going to merge something you did not intend to, and possibly catch some merge issues along the way. You will also run your version of the project after merging but before pushing as a last verification step that there aren’t any obvious problems - if you don’t do that and there are problems it is an embarrassment for you and frustrating for everyone else. Act professionally. ;)
     
    IntoTheSoul likes this.
  5. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Manually reverting back and forth is yuck. You're gonna eventually mess this up. Relying on code reviews to catch this kind of thing seems like a massive waste of time/energy.

    You could do some kind of git hook for commits that strips certain defines. You could do something in csc.rsp.

    I'm not sure, but I don't like the idea of manually managing something like this.
     
    IntoTheSoul and DragonCoder like this.
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,977
    We have a "prepare build" script that sets Project Settings (well, not everything in Project Settings, but a big chunk) to what we want for a build, so we can do experiments and temporary things to them without worrying we will actually release a build with weird settings.
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,977
    ChatGPT getting increasingly annoying. Go away.
     
  8. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Nah, chatgpt is smarter than that.

    Chatgpt's answer:

    In Unity projects, the ProjectSettings.asset file contains various configurations for your project, like input settings, graphics, audio, time, and other general settings. These settings are typically shared across all development environments and are necessary for maintaining the consistency of the project on different machines.

    Therefore, you generally wouldn't want to add ProjectSettings.asset (or the entire ProjectSettings/ directory) to your .gitignore file. If you do, different members of your team might have different project configurations, leading to inconsistent behavior and potentially hard-to-track bugs.

    That being said, you should be mindful of which files within the ProjectSettings/ directory are essential to your project, and consider whether they need to be version-controlled. Some settings files, such as those related to personal editor preferences, may not be necessary to include in version control.

    _______

    but yeah - that guy does seem to be a bot or something.
     
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,977
    It is not. At least the free one, plus you can ask it the same question multiple times and it can answer differently each time. The reply it gave me is closer to the post:
    upload_2023-7-11_20-26-0.png
     
  10. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I posted gpt4 the non free version response. I could ask it a thousand times and it'd never tell me to avoid putting it in source control unless i lead it w prompting.

    He probably isn't using openai but one of the opensource LLMs.
     
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,977
    I don't know, I had ChatGPT Plus for a month and gave up on it after a few days since it didn't seem like a substantial improvement to me... but we're getting off topic here.
     
  12. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,128
    It contains a lot of release settings you want to maintain, however it does have an odd section which I get differences on for an unknown reason:

    Code (JavaScript):
    1. preloadedAssets:
    2.   - {fileID: 842770249587, guid: 1e7536abaa606e..., type: 2}
    3.   - {fileID: 11400000, guid: 6652602b3c5e0..., type: 2}
    Not sure what that is and why it can differ between PCs.