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 New saves affecting assets in old saves -why?!

Discussion in 'Editor & General Support' started by Prodical, Sep 21, 2023.

  1. Prodical

    Prodical

    Joined:
    May 7, 2013
    Posts:
    10
    Hi,
    Like the title says, I have new saves affecting old saves. I'm guessing it might have something to do with how I'm opening/saving the files?
    To open: I go into my Unity assert folder and open the latest version of the project.
    To save: I 'Save as' and add another sequential digit to the file name.
    i.e.
    save-locale.jpg

    If I make a modification to an asset in save 16, it affects all of the previous saves. Here I will delete a material in save 16:
    missing-in-16.jpg

    Now, I open save 2 and the material is missing (the editor view is also the same):
    missing-in-2.jpg
    This functionality is unintuitive and destructive. How do I make project saves and their assets independent from each other?

    -thanks.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,561
    That will likely only save a new copy the top level thing.

    Almost everything in Unity is composed of a hierarchy of assets: Meshes, Materials, etc.

    Those assets would never be cloned unless you clone them yourself and reassign them to your copied item.

    Pretty much 100% of Unity works this way.

    Here's some more reading:

    Unity's component architecture

    https://forum.unity.com/threads/custom-gameobject.967582/#post-6299125

    Terminology primer for assets:

    https://forum.unity.com/threads/con...nto-materials-for-quads.1369056/#post-8632563
     
  3. Prodical

    Prodical

    Joined:
    May 7, 2013
    Posts:
    10
    Can I be brutally honest... this makes no sense to me. Is there a way I can create independent saves (so that assets won't be affected by new saves)?
    There must be a way?
    I'm quite happy to use more hard disk space if that is the issue here?
    Do I have to use another computer, or partition drive or something?
    Why is no other program I've ever used like this?
    How are you supposed to rapidly prototype/experiment if none of your saves are secure? Isn't that a cornerstone of the digital creative process?

    -I must be missing something fundamental here?
     
  4. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    729
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,561
    A couple of things come to mind, yes.

    - Unity is a successful commercial game engine used at scale by millions of people, thousands of large developers

    - their approach to asset management works well with filesystems and source control

    This isn't even a wrong statement. It's simply not relevant to any part of the problem domain.

    PROPERLY CONFIGURING AND USING ENTERPRISE SOURCE CONTROL

    I'm sorry you've had this issue. Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    I usually make a separate repository for each game, but I have some repositories with a bunch of smaller test games.

    Here is how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally the ONLY folders you should ever source control are:

    Assets/
    ProjectSettings/
    Packages/

    NEVER source control Library/ or Temp/ or Logs/
    NEVER source control anything from Visual Studio (.vs, .csproj, none of that noise)

    Setting git up with Unity (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It's simply ridiculous not to back up.

    If you plan on joining the software industry, you will be required and expected to know how to use source control.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards
     
    Prodical likes this.
  6. Prodical

    Prodical

    Joined:
    May 7, 2013
    Posts:
    10
    -Thanks. My team is using Fork, but I'll certainly give Version a try.

    I'm still confused. Fork and Version strike me as incredibly clunky workarounds (3rd-party apps scanning for changes etc). There should be a "Save project and assets as new project" option in the editor?
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,561
    I haven't used Fork or Version but assuming they work like any of the other modern source control systems (git, Mercurial, SVN, Perforce), you can just make a branch and go nuts with your experimentation.

    If you don't like your experiment then you revert the branch, or just leave it there as a monument / example.

    With systems like git and Mercurial, everything you do is automatically a new branch, something that by definition does not affect anything you've already done.

    YES, there is a learning curve. YES, it requires you to think in terms of workflow and branches. YES, you can make mistakes and botch it all up.

    But there's ten billion tutorials out there and plenty of support. The software industry has been version-controlling for a long time now. This is a Fully Solved Problem(tm).

    At the end of the day, until it leaves your computer it is all just files on a disk, subject to 100% of all the data loss precautions.
     
  8. Prodical

    Prodical

    Joined:
    May 7, 2013
    Posts:
    10
    I'm not arguing with you, and I appreciate the feedback. But this whole system looks as though it's been designed specifically for data sharing amongst large teams (where I assume it's impractical to save 50gb+ files every time).
    But that's not the only use for a game/graphics engine? I'm working on a small interactive display for a client; many other new users will be indie devs or hobbyists. "Source control systems" are a horribly complicated method for something that is a one-click function in every other program that I, and they, would've used. Not only that, it is unintuitive and destructive. Most new users will think that creating a new save does exactly that (including assets).
    "YES, there is a learning curve. YES, it requires you to think in terms of workflow and branches. YES, you can make mistakes and botch it all up" -Why does it have to be that way, why not just add a "Save project and assets as new instance" option in the editor?
    Does UE have the same functionality (or lack of)?
     
  9. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,833
    This isn't PowerPoint.

    As a project grows, an independent project instance with all of its intermediate storage will quickly become many gigabytes. It's ridiculous to wait for the system to make a full copy of all of that, and it's ridiculous to consume that much storage, no matter how "cheap" it is.

    If you really want to make a fully independent checkpoint backup, exit Unity and ZIP up the project folder, with a name like 2023-09-21.MyProject.zip and back those up.

    Otherwise, stop trying to think of a project as being a single little file and start thinking of it as a large sprawling interlinked web of data. Making a little change to a scene file or a material or a texture is not worth duplicating the entire web of data. Version control systems are designed to keep track of small changes within a project, so that you can always recreate what the project was like at your checkin last Tuesday. They're way more efficient.

    Unreal Engine also treats a project as a large sprawling interlinked web of data, and does not have a "save whole entire project to a new independent instance" because it makes no sense.
     
    Prodical likes this.
  10. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,561
    Source control is just source control.

    It would make sense if you thought that an item "contained" all the stuff that it uses.

    This is simply not the case: a prefab or scene (normally) contains NOTHING.

    Prefabs / scenes are simply organized indexes of assets and metadata telling the game engine how to load stuff.

    I will however agree with you that, "Wouldn't it be nice" if you duped an entire directory, that Unity could go into the duplicate and relink every asset that was also used. But it doesn't. There are GUID remappers you can use to effect this by exporting, renaming, reassigning GUIDS, then reimporting.

    But again, nobody really does that. Just use source control and be aware of what file you are transacting against when you say "dupe this." The rules are remarkably consistent once you work with them a bit, but they do still surprise people. I haven't seen software that doesn't have at least some surprising behavior.:)
     
    Prodical likes this.
  11. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Scenes aren't 'saves', they're scenes, or better put they're another asset. Assets made up of other assets, made up of other assets, made up of other assets, and so on and so forth. That's pretty much how Unity works, as do a lot of if not all game engines.

    Point being so that you can modularise your project. If you have a prefab and use it across a dozen scenes, you can change the prefab and said changes will proliferate to everywhere it's being used. The alternative would be useless workflow wise.

    Source/Version Control is not at all as difficult as it seems. I just use Github Desktop and it's been pretty much painless.
     
    Kurt-Dekker likes this.