Backup, Backup, Backup
So, today I learned a hard lesson. One that I knew could happen but I kept pushing off the solution until it was too late. Backup everything, version control is key. I have always done this with all of the projects I have done. I usually use GitHub for this purpose and I constantly push commits through so nothing is lost and I can step backwards if I get too deep into changing my code.
I have been working on the 2.5D frameworks for the past couple of days and at first I tried to push into GitHub to get my version control going but the files were over 100MB which is the limit GitHub will accept. My 2T external hard drive is sitting right in front of me unplugged from my computer for the past couple of days too.( I had to pause to plug it in as I'm writing this, obviously I haven’t quite jumped on learning from my mistake quite yet. I also dropped the project files Im working on into the hard drive too. )
I was moving along with the Frameworks today, coming to the end of all of the tasks. The only thing left was the ladder climb. I completed moving platforms, elevator lift, collectables, run, jump, roll animations. There wasn’t much left to do. Then, as I was moving some files around Unity started to freeze up a bit on me as it does from time to time, it usually happens for a couple of seconds then keeps working as usual. I was about to delete a Sprites folder I had in the project when it started to happen. It came back then I went to delete and I ended up deleting my Scripts folder instead. Then Unity crashed and I had to reload it. When I opened it up, nothing was working at all, I looked and none of the scripts were in my files at all. At first I thought it was because of the freeze and shut down. Then I realized, it was my mistake and I wasn’t paying enough attention to what I was doing out of frustration with Unity. I also found out the hard way, once you delete a script file from Unity, there is no way to recover it, it’s gone for good.
So, here I am now, rewriting all of the code I worked days on. As bummed, ashamed, and slightly angry at myself as I was when it happened, I feel it was meant to happen to teach me a valuable lesson: Backup, Backup, Backup everything constantly. Also, I get to write all of the code over again! I’m actually ok with this because mistakes like this create amazing learning opportunities. It is showing me what I have learned as much of the code I lost I am rebuilding without referencing much, mostly working off of memory and logic. It also helps because I get to type it all out again and create some muscle memory for many of the properties and Methods that I have learned along the way.
Lesson of the day: Backup everything, Version control is your best friend as a programmer, mistakes are amazing learning experiences and will make you better in life in the end. Go make some mistakes everyone!