There really should be some kind of lock you can put on certain folders or files in Unity

So that’s twice this has happened to me now and it’s my own stupid fault, I wasn’t paying attention to what I was doing and I’ve managed to delete my resources folder which means I’ve just wiped out all the prefabs I placed in my game 20 game levels for a nearly finished project and I was just going to place a few more traps and so on in my game to flesh everything out and a couple more shortcuts later BAM!

I didn’t panic, I knew the meta file was in my recycle bin but unfortunately I foolishly right clicked and restored the file directly from the recycle bin. Little did I know, Unity doesn’t like this and it actually ended up wiping the damn meta file which I could have saved so now I know that you should just keep a copy of it safe just in case and directly put it in the folder. It didn’t just delete the file that got sent to the asset folder you see it had removed that from the recycle bin as well, and this is why I don’t trust computers when they do things on their own.

Adobe Photoshop has features like this where you can lock certain layers to prevent them from being deleted and drawn on by accident, is there any chance that Unity is going to have this put in as well? I’m sick of making mistakes like this, thankfully I have all my sprites sensibly backed up and so on and I roughly remember where I placed everything, it’s just a bit of time waste.

Now if you’ll excuse me, I’m going to go and sob pathetically in a corner, I am so glad I didn’t put my code in the same folder as well.

Register at gitlab.com, it’s free up to 10gb

I made mention of this really stupid behaviour over in this thread here.. This sort of behaviour for basic file system operations should not be considered acceptable.

No, the problem you need to own up to is that you have yet to start using a Version Control System. With a proper VCS you would have been able to quickly recover the files and any modifications that had been made to them from the first time they were added to the project to the last time you committed a change to the repository.

https://assetstore.unity.com/packages/tools/user-tools/utilities/hierarchy-folder-object-10966

6 Likes

Proper version control is the right answer. With version control you can restore the missing folder and meta data in a few minutes.

If you are insistent on doin things the wrong way, Unity will also respect the filesystem. So you could mark critical files as read only there. It seems super painful though.

5 Likes

Unity will sort of respect the file system. As mentioned in this very thread, what should be a simple operation (restoring from the recycle bin) leads to Unity just outright destroying the file. It doesn’t move the file back to the recycle bin, it doesn’t accept it into the asset folder as it should, it destroys the file.

That, to me, seems like the very opposite of respecting the file system. I shouldn’t have to go into a repository to get a file back when there’s a perfectly good windows operation to do just that locally.

Just advocate version control. Even Unity’s own collab is fine if you have no brain and need security. Just pay the 5 dollars a month or whatever it costs. Stop pooping over your own work, everyone-not-on-version-control-yet.

I don’t take any developer seriously who isn’t on version control of some sort. It means they’re just messing about for fun. No harm done but anyone with a mind for results: version control.

I wonder if I’ve mentioned version control yet? I think Kiwasi did.

3 Likes

BTW I think I forgot something: version control.

5 Likes

I think Hippo forgot something…

VERSION CONTROL

3 Likes

By respecting the file system I mean you can mark a folder as read only in the file system, and Unity will respect that.

The moment I discovered the value of version control was as important as when I discovered “debugging” was not about placing print statements everywhere to see the flow of code.

4 Likes

Well like I wrote in my OP, I have actually got all my files and so on sensibly backed up, you know, sprites, code and so on, it’s just I’m going to have to place my prefabs all over again. So I guess what this means is as you guys say I should just make extra copies of folders and stuff I don’t want deleted by accident, it just seems like there could be better features to prevent this type of thing like the lock I mentioned on photoshop.

I know it’s easy to be a smug experienced programmer about all this :stuck_out_tongue: but you’d be surprised how easy it is especially in a program like Photoshop or Maya to make catastrophic mistakes if you click something while distracted and not focusing, all this complicated software seems to have a similar problem.

No, it’s just you. Not being smug, but it will carry on being you until you decide not to be sloppy about it. Same thing with leaving the oven on and things like that. You have to choose to be careful.

1 Like

If was sloppy I wouldn’t have backups of all the assets I’m using for this particular game, as for your suggestion about version control I’d rather not rely on any third party tool. I guess once I’m done placing my prefabs I’ll simply make a backup of my resources folder outside Unity and if something happens again I’ll simply copy it over and keep the majority of my progress.

That was a rather poor choice, wasn’t it?

Right, it’s called human interaction. Humans are inherently illogical. They’ll often choose the worst possible solutions and often in spite of the glaringly obvious evidence telling them it was the wrong choice. Then after facing the consequences they’ll often go back and do it again.

https://en.wikipedia.org/wiki/User_error

3 Likes

Exerpt from suggested user error wiki reading:

"Experts in interaction design such as Alan Cooper[3] believe this concept puts blame in the wrong place, the user, instead of blaming the error-inducing design and its failure to take into account human limitations. "

Locking things you consider finished to prevent accidentally changing them dosent seem like an unreasonable request in a complex system.

Yes, but that’s only assuming the individual makes use of them. He’s been told in this thread, and I’m fairly certain we’ve had a similar discussion with him in the past, about version control and he’s deliberately choosing to ignore it. At some point you have to stop blaming the software and start blaming the user.

1 Like

Oh I see you point here. I’m incredibly new here and was only thinking from this threads information. Being able to lock things does seem handy but would not keep you from needing to back up or use version control. I was just seeing an easy checkbox so when my cat walked across the keyboard and I wasnt looking I knew some things would still be as I left them. I get lazy too, drop my mouse and go digging for it clickin things. Almost a way of telling unity I was done with this part and dont let me screw it up please. This would probably be alot more useful for new users like me than someone who is very used to the editor.

If we are going to go for locking, I would like to be able to lock specific layers in a scene. That would be convenient.

Locking asset folders doesn’t make much sense for my workflow.

Well, this is a wrong choice, because version control software does much better job at tracking changes than manual backups. Copying old version over can also mess up majority of your progress. It is a wrong idea.

I suggest ot learn git or mercurial. Decent version control also allows you to develop several versions of the same project in parallel, easily revert to old revision, and easily track down when some bug was introduced.

I’m not sure about gitlab, but bitbucket free account allows private repositories. Unlimited number of them.

1 Like