Search Unity

Accidentally moving folders within project window.

Discussion in 'Editor & General Support' started by LethalInjection, Aug 9, 2021.

?

Add file dialog prompt to editor when moving files in project window

Poll closed Sep 8, 2021.
  1. YES, add dialog feature

    1 vote(s)
    33.3%
  2. NO, feature not needed

    2 vote(s)
    66.7%
  3. OTHER,. please add comment to thread

    0 vote(s)
    0.0%
  1. LethalInjection

    LethalInjection

    Joined:
    Jan 25, 2015
    Posts:
    37
    Hi Everyone,
    I have accidentally moved folders many times within my unity projects and spent up to 15 minutes trying to undo what I did. I don't like doing ctrl-z because that might undo other settings i applied to objects.
    I have search the forums and the internets for potential solutions and nothing really preventive, all the answers seem to be reactive.

    Is anyone else frustrated and do you consider this a common issue ?

    I feel the easiest fix is to prompt a yes/no confirmation dialog when moving folders within the project window.

    Anyone else think this might be a good feature to add ? Any comments welcomed.

    Thanks,

    P.S. [Edit] Obviously not everyone would want this feature, so a checkbox to enable or disable prompting in the editor preferences or wherever appropriate would be appropriate implementation.
     
    Last edited: Aug 9, 2021
    unity_iogames and Whatever560 like this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    It happens sometimes, but it's trivial to instantly fix. See below.

    As it is now the year 2021, please consider using proper industrial-grade 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.).

    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

    Here's 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 the right .gitignore file:

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

    Generally setting Unity up (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.
     
    Joe-Censored likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    This feature sounds irritating. If you do make this kind of mistake and can't immediately repair the damage, that's what your source control system is for.
     
  4. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Visual Studio has this feature, along with an option to turn the dialog prompt off if desired.
    I can see this being a useful addition to Unity if it's implemented in the same way.

    But yes, as already mentioned, use source control regardless.
     
  5. LethalInjection

    LethalInjection

    Joined:
    Jan 25, 2015
    Posts:
    37
    Thanks for the suggestions.

    I already use SVN, and source control is reactive answer, as I would have to use the feature to compare or checkout, to get what was last saved in the repo.

    What if I haven't saved it yet to the repo and I purposefully made other changes to other files and folders but not checked them in yet as well. Maybe it was a newly installed package.
    What if some people don't use source control ?
    What if source control system is down/unavailable or undergoing maintenance ?
    What if someone is purposefully excluding a folder because it is apart of a custom package or plugin ?

    For myself, I don't move directories in Unity because it is easier to do with SVN anyway, so that 2-3 times a year I accidentally drag something is way more of a nuisance to me than being prompted.

    This option maybe irritating to some people, but that is why I suggested a checkbox to enable (opt-in).

    Just because the confirmation prompt may not suit your needs, doesn't mean there are people out there who would use it. The point of the thread is to see if anyone else sees value in this.

    Thanks everyone for reading. Happy Developing :)
     
  6. LethalInjection

    LethalInjection

    Joined:
    Jan 25, 2015
    Posts:
    37
    If Unity exposed the "move operation" with an interface much like IdragHandler then anyone could attach code as they see fit. Not attaching anything would be the same as it is today.

    Potential reasons to attach code:
    Logging of the operation
    Command to send to Git/SVN such as commit move oepration.
    Generate Assembly
    Generate MipMaps/LightMaps/cached data.
    Call another script.
    Save project Settings/Assets
    Confirmation Prompt

    Unity may do things above auto-magically, but I included them because there could be edge cases.

    For me obviously I would check if the target is a folder, then if so prompt something to the user, then cancel the operation if applicable. One could even code a default Y/n and an auto-accept Yes/no to the prompt if not answered within 30 seconds.

    This exposure would only be available in the editor.

    As far calling another script, it maybe that certain assets are hardcoded with Resources.Load method such as in a text config file or database and would need to be updated if moved.

    I don't use Unity's ability to "associate" public objects within the inspector because it is cached in the library folder and I'd rather save it programmatically.

    edit: just minor typos.