Auto-save in Unity? About time...
How is auto save in unity not a thing?
Prevent hours of lost work with auto save. I built this after losing 2 hours of level design work and so far it's been wonderful... So I thought I'd share it with the world. Hope it can help you too!
Source: github.com/Matthew-J-Spencer/...
❤️ Become a Tarobro on Patreon: / tarodev
=========
🔔 SUBSCRIBE: bit.ly/3eqG1Z6
🗨️ DISCORD: / discord
✅ MORE TUTORIALS: / tarodev
Пікірлер: 205
Amazing! New challenge: a checkbox on components to save all the changes during play mode (yes I know you can copy and paste as values, but that only works for one!)
@yummybunny7351
2 жыл бұрын
Good idea
@ghostderazgriz
2 жыл бұрын
Actually this can be done with a scriptable object. There are some easy to follow tutorials on it. Add a scriptable object and you can save changes during runtime. Love your videos Mark :). I'm rooting for you in the Unity awards.
@fredg697
2 жыл бұрын
@@ghostderazgriz this is a very bad advice imo. scriptable ocjetcs are not meant to be used as replacement for gameobjects. Scriptable objets cannot contain references to scene or execute unity loop methods like awake or update.
@fredg697
2 жыл бұрын
I'm quite sure it would require a lot of work with custom editor scripts. You have some implementations on the unity asset store but none of them are free. Btw I love your content, keep up the good work Mark !
@ghostderazgriz
2 жыл бұрын
@@fredg697 This is true, but scriptable objects need only serve as an intermediary. Not to replace monobehavior. Flexible data can be stored in the SO while fixed or runtime updated data stays in the game object.
"more exciting" was good, no need to apologise.
Never knew Unity didn't have this feature. I've been lucky enough to not lose hours of work
How are you not the top Unity Game Developer on KZread? Your videos are top tier. Quick, detailed, and exciting. Thank you for the amazing tool!
@Tarodev
2 жыл бұрын
Thanks Owen 🙏
You are a lifesaver and that 1 minute was the most exciting thing of all time.
@Tarodev
2 жыл бұрын
Mission accomplished 😎
I was about to table this until I "needed it", but then you gave that damn warning at the end. Installing now...
I lost 3 hours of work now, because the unity crashed on instal of Text TMP. Thanks for this, it's currently working for me.
You may have experienced a bug in the previous build where the config SO would be unlinked after an editor restart. This is now fixed
@RealisiticEdgeMod
2 жыл бұрын
Hey tarodev. I cant believe you still use consolas in 2022. Cascadia code is the new standard. It has ligatures and everything.
@Tarodev
2 жыл бұрын
@@RealisiticEdgeMod I've never used ligatures. You obviously reccomend?
@RealisiticEdgeMod
2 жыл бұрын
@@Tarodev Can recommend. I think cascadia code semibold would be more readable on your videos.
@secretservicebob3288
2 жыл бұрын
@@RealisiticEdgeMod Such an interesting way to approach someone: "I cant believe you still use ... in 2022." There's a reason you can pick from multiple fonts in the editor, each to their own. Good to inform people, just not a fan of the execution.
@RealisiticEdgeMod
2 жыл бұрын
@@secretservicebob3288 Its not just one of the fonts you can choose from. Its a newer superior font that has superseded consolas.
This is amazing Tarodev! You are such a beast.
Another awesome video from you. Keep up the good work!
Awesome, I will definitely use it :). Great idea!
CTRL + S is hard coded in my mind
haha.. that auto save anticipation cut is awesome
@Tarodev
2 жыл бұрын
Not easy making an astrix disappearing interesting 😜
So cool! Thanks for making this and sharing it with us all for free. Works great and will undoubtedly save me a load of time and energy. Looking forward to watching more of your videos.
I've never had an issue about losing scene progress, but I've scratched my head a lot about how to save assets and trying to figure out what the hell is a dirty asset. I'd love to see you tackle the asset thingies. Also, loved the editing.
Bahahaha ok this post is pure gold!!!!! Tarodev you are a legend!
I have the tic of keep pressing Ctrl + S but this is very useful indeed!
You just saved my life...sweet code bro. Needs to be a feature in the next Unity build. Keep it up!!!!!!
That's just great! Thank you so much!
Great tutorial Thanks Man!!👍
Oh you sweet, sweet man. I thank you so sincerely for this.
Imagine chuckling at a video about auto-save. Great one bro!
@Tarodev
2 жыл бұрын
Thanks buddy :)
@CheeseChuckie
2 жыл бұрын
@@Tarodev Why you keep replying to my comments, huh? You like me or something? I suppose there's always been some kind of chemistry between our people: those with beards and those that have been trying to grow one for like 10 years but just end up getting laughed at by everyone and resort to just subscribing to those that have what we may never possess... It's probably that.
@Tarodev
2 жыл бұрын
@@CheeseChuckie I'll send you some of mine in the mail and you can use adhesive
Unity needed this, taro provided! As always
Thanks Matthew - first job in the morning will be to set this up 😎
It would've been better if it auto save a new scene as a backup and not overwrite the current one because sometime you could mess things up and you wont want your scene to be overwritten by your current mistakes
@ghostderazgriz
2 жыл бұрын
That sounds like it would be inefficient. My best advice is to upload build versions before making critical changes. No program can really make that decision easy because only you know when a critical change is going to occur.
@r6scrubs126
2 жыл бұрын
@@ghostderazgriz that's how a lot of auto saves work though. They just save a backup copy with a different name. If your program crashes and you didn't save, you go open one of those backup copies. If it doesn't crash, you just save whenever you want as normal and there's no risk of it auto saving your main file when you didn't want it to. There's nothing inefficient about that.
@ghostderazgriz
2 жыл бұрын
@@r6scrubs126 In a normal program you'd be right, but when you're making a game or anything with massive amounts of data, you want to compress that data into version files, like how the package manager first installs a package and the package unpacks all the components you want. Otherwise you're saving entire duplicates of data, not all of which is necessary for the game to be saved, and that takes up a lot of space. The most efficient method is to export packages (found under the Assets tab). I don't know if exporting can be automated but I do know that there maybe objects you don't want exported with each version, or experimental features you want exported in separate packages. In those cases an auto-package program could hurt your version control and mess up your file organization. I think it's better that you decide for yourself what to back up and what not to, but I could be wrong.
@Warwipf
2 жыл бұрын
Just keep a repo for version control. Additionally with apps like Github-Desktop you can easily revert any saves you dont like locally.
Awesome thanks Taro Dev
@Tarodev
2 жыл бұрын
Billy my boy, you're welcome
really useful, thanks!
That edit 😍
this is awesome !!! thanks !!!! My Hero~~~~
Good Work man thanks!
Thanks for this, really useful!
Its one of the best things i've seen for unity
Thank you so much!
Hi, I set this up, but I don't hear the dramatic build up or dance music in my editor. I also don't see the screen shake on save. Please add these in the next version. /s
@Tarodev
2 жыл бұрын
Haha 😂
I died when it dropped. You're a wizard.
Very useful!
Thanks Man!
God bless you, bro
Love your work! I did notice in your 'SaveInterval' task you have the following: await Task.Delay( *_config* .Frequency * 1000 * 60, token); if ( *_config* == null) FetchConfig(); So you're accessing '_config' before checking for null.
@Tarodev
2 жыл бұрын
Oh shoot, let me swap those. Code review FTW
Thanks!
You saved week of my life
10/10 edits
hey Tarodev love your work man btw i got inspired and switched my channel from a gaming channel to a game dev channel thanks
@Tarodev
2 жыл бұрын
I watched your videos. Keep it up!
@IDENTICYEA
2 жыл бұрын
@@Tarodev thank you so much i will never forget this
@IDENTICYEA
2 жыл бұрын
@@Tarodev and please sub too thank you
Lol! I've never laughed so hard at an asterisk disappearing 😂
@Tarodev
2 жыл бұрын
Mission accomplished
Love it
that was insanely epic
Bro That Song Kinda Hits Differnt At 1:33
Thank you for doing the work for Unity. The gatekeeping dogma of "get good, save often", doesn't take into account those with ADHD who have a hard time remembering things when they're focused on something.
I don't know why but Unity crashing when you were using a color picker cracked me up😂
@Tarodev
2 жыл бұрын
It didn't crack me up at the time
After many years of working in Android development were there's no need to manually save anything, getting back into Unity was kinda hard, and I lost work right away. I forgot how easy it is to crash this IDE. Thanks for the greeting btw, girl here.
@Tarodev
2 жыл бұрын
I don't believe you EDIT: My wife just told me my above reply was rude. So sorry about that :D Thanks for watching Nucifera!
@mhrohan917
2 жыл бұрын
0_0 sus
@ghostderazgriz
2 жыл бұрын
"girl here" Sounds like something a boy would say! And I should know, I'm dating a boy, and he says that all the time. I keep telling him, to stop like "Please, honey, this is a funeral" but he just can't help it. That's a real scenario I didn't make up cus I'm an authentic human female person with boobs and stuff. (Certified by the Board Of Typical Sapiens [B.O.T.S])
@Tarodev
2 жыл бұрын
@@ghostderazgriz this is legit
@Nucifera8472
2 жыл бұрын
@@ghostderazgriz funny, I totally wasn't aware because I'm not a native speaker. How can I make it sound more believable in your opinion?
I’m working now on unity for 3 hours and unity decide to crash every thing is gone and need to do it again It’s really sad that you trying your best to make something and in 3 seconds every thing burn , sometimes you need tow fingers to save your life . What i’m doing , just thank you, that will help me alot ❤
Very recently, windows rebooted during the night (without asking me, obv). Of course I didn't save before going to bed. Always a pleasure.
@Tarodev
2 жыл бұрын
Well this is the perfect solution 👌
stonks!
iam a fan of your videos your videos helped me alot in many ways .just one request can you make one video on how to create 2d water and how to swim in it
The facial expression at "I can't believe i'm about to show you how Auto-Save works" - like you really hated life for a second 😂 - PMSL! - Amazing tool thanks for this!
That's great! Combining this with Git and an online repository would make any project almost inmortal
@Tarodev
2 жыл бұрын
Wait until you find out about Rider's local history. It's like a git commit every time you save a script... magic. Saves my ass constantly.
@SilverAura
2 жыл бұрын
@@Tarodev That's kind of crazy to think about too because unlike most software, you literally need to save your scripts before you can even compile them in Unity to test if they even work. So for me, git commits have sort of taken that mental space where I think of "saving" my project. Which is to say, if I was required to save every single time I wanted to see the final composition of all my layers in Photoshop, I'd go crazy without a way to revert back to a particular state.
@Tarodev
2 жыл бұрын
@@SilverAura Kind of makes a JIT compiled language like JS seem more valuable to this kind of work... Save, alt tab, play immediately.
@BrandonNyman
2 жыл бұрын
@@Tarodev and with that I think I will switch from VS to rider
@Tarodev
2 жыл бұрын
@@BrandonNyman You wont be disappointed
I think it should be saving to somewhere else. If unity crash than you can get the recent file. Just like how it works on office programs. Otherwise it can save a state that i dont want.
@Tarodev
2 жыл бұрын
I was thinking this... I originally set out to make a separate save history users can revert to... The user could set how many temp saves there are before overwriting. I'll look into it to see how much work there is and maybe offer an alternative version. Good suggestion!
@SilverAura
2 жыл бұрын
@@Tarodev Honestly if it were me (which I'm still notice so keep that in mind), I'd just allow for an alternative backup location in the settings, then simply use new location if it's a valid path, warn if it's invalid, and revert back to the current behavior if left empty. If you wanted to go the extra mile in my shoes, I'd probably do that... then realize it's probably a good idea to have a checkbox "Overwrite existing scene" that would give you the option to select a path. That way there's explicit and clearly labeled step you'd know you were taking when choosing your preferred behavior.
@BrandonNyman
2 жыл бұрын
@@Tarodev did you ever get round to looking into this? But otherwise this is already very nice to have just in case
YES ❤
The color picker crash has been happening to me a lot lately too.
@Tarodev
2 жыл бұрын
First time experiencing it. I wonder what causes it
It just happened to me after I ignored your warning. I feel humbled
@Tarodev
2 жыл бұрын
Muahahaha
UUU aaaa good one.
Best !
Cool! I just made a simple script that saves the opened scene on Play
Meanwhile I still have memories of windows 98 (95?) freezing during an auto save and corrupting my file.... so instead of just losing the changes that didn’t save I lost everything.
@Tarodev
2 жыл бұрын
Hah... golly
Worst is when unity crash and even if you save scene, project before crash after load it's like nothing was saved except SO(?)
Can we change default hierarchy elements? For example I want specific prefab when creating a new slider. Possible?
One time I was fixing a bug with animations while setting up the animator for an enemy, Unity jest froze and I lost a hour of work.
@Tarodev
2 жыл бұрын
I got just the tool for you ;)
The project I'm working with at the moment takes several seconds to save the scene (not my project, I just started working with the team), at which time the entire editor becomes unresponsive. Unfortunately a periodic autosave is not a viable solution for me. I even had to turn off Unity's built-in autosave on the prefabs because it took so long to write the prefab to file after each edit.
@Tarodev
2 жыл бұрын
Oh man! AAA?
After losing hours of my own work, I have a compulsive habit to hit Ctrl-S every time I change something. Auto-save is much better :)
You know what unity needs : a recover feature like adobe has
@Tarodev
2 жыл бұрын
This would be good. Incremental background saves. Would actually be pretty easy to make
I haven't seen it mentioned that unity saves the scene every run to /Temp/something/0.backup or something like that, you can rename the scene to a .unity file and load it up. As long as you remember to manually do it before it overwrites it
best marketing ever
nice
Good my ctrl+s game is quite good
Does it also save the project? I've lost work on s critical moment because I've edited an asset (I think a ScriptableObject) and didn't save the project.
I'm not able to look at the code in depth right now, but I'm curious how it handled having multiple scenes open? Does it only save the top-level scene? EDIT: there it is: "SaveOpenScenes" - cool!
@Tarodev
2 жыл бұрын
This is both a boon and a curse. I'm just imagining a multi scene workflow with 15 scenes...
Editing video in Sony Vegas is a great way to train up your CTRL+S game. That fucking program crashes all the bloody time.
@Tarodev
2 жыл бұрын
Oh dude, premiere too. It actually crashes my entire pc. I get trigger finger in premiere
Awesome *Star* is gone . Our Life is saved.
I CTRL+S even when I write emails. Literally doing it everywhere xD even after I finish watching a movie So I think I'm good for now :)
@Tarodev
2 жыл бұрын
I need to up my game
@krissloo143
2 жыл бұрын
😂😂😂😂
🤣🤣 the sound effects
tysm i just lost 5 hours building a map and its gone, fml 😮💨😭
me the one of two girls feeling recognized and validated
What is it about colour pickers? They crash blender the most for me too! No one talks about it tho. But it's the colour pickers that house the true evil .
@Tarodev
2 жыл бұрын
How strange...
Noice
Nice, but will it pop up the "Can't save while playing" message every minute that I'm playing the game?
The thing that kills me the most is when Unity decides to crash shortly after saving a script in Visual Studio. I've literally had to go in and just straight up turn off the asynchronous complication under the Unity plugin in Visual Studio because it's like a child when leave it alone too long. >:[
maybe they don't implement it by default is cause for me atleast everytime I hit ctrl s it just takes like 20 seconds to application.reload or similar messages
@Tarodev
2 жыл бұрын
Oh god, yes that would be horrendous.
When you restart the project the scripatable object can not find the associated script. Also when trying to find the config after resatrting your project i get> NullReferenceException: Object reference not set to an instance of an object Tarodev.TarodevAutoSave.ShowConfig () (at Assets/Editor/AutoSave.cs:92)
@Tarodev
2 жыл бұрын
Interesting... Let me investigate. Thanks for bringing this to my attention
@Tarodev
2 жыл бұрын
I've fixed this issue, thanks for bringing it to my attention mate 🙏
Sometimes i just try things without saving so i can revert back if i don't like the changes i made. (I can use git i know but im talking about small ui changes without ctrl+z) Maybe a boolean for "enable " can be added to config. Edit 0: (But then you can forget to "enable" auto saving after you disable it, that would be funny) Edit 1: (Maybe you can then write a script that auto enables the auto saver after some time? (paradox?))
@zbyszekkiebasa906
2 жыл бұрын
This sounds more like, you problem
@Tarodev
2 жыл бұрын
This is getting deep
@jumpingman6612
2 жыл бұрын
@@zbyszekkiebasa906 hahah
Sacred knowledge is usually occulted. Not by intention, but because the masses prefer mainstream and popular, over informative and proper.
I love you
Oh, yes, Color Pickers are evil. As are, from personal experience, events. At least, that's when Unity loves to crash my project 😒 Thank you so much for this video and tool!
Wait, do you mean you do not do a Ctrl + S every 2 seconds ?
@Tarodev
2 жыл бұрын
Not in the editor apparently 😭
the script (im on the right script) wont give meant and enable option, just the file info, please help
@stoppedmotion7585
Жыл бұрын
the config script doesn't have the "box" icon yours does so that might be why but idk how to fix
@stoppedmotion7585
Жыл бұрын
also it isn't making the autoconfig script
@stoppedmotion7585
Жыл бұрын
ok, sorry now the file generates and it looks like it looks but the script is attached (not sure if that has anything to do with it) and it doesn't actually save(I'm testing this by running the script for a minute, closing the window, and seeing if it says do you want to save changes.
@stoppedmotion7585
Жыл бұрын
nvm, think it works tysm
@Chronus8888
Жыл бұрын
Hey if anyone else has this issue, it's because the project has been updated since the video was made. There are now two files you need to copy into your project. Move both the "TarodevAutoSave.cs" AND the "AutoSaveConfig.cs" into your project. Then, they will create the object you see in the video. For me, the object was created directly in the "Assets" folder and not in the same place that I copied the files. Click your Assets folder to find the new object.
Could you just simulate "CTRL" and "S" being pressed every interval?
@Tarodev
2 жыл бұрын
You could with a tool such as auto hot key, but I could see that causing problems
@devlasutriv
2 жыл бұрын
Maybe by using keyboard events: docs.unity3d.com/Manual/UIE-Keyboard-Events.html. Doing this would preserve any checks that Unity does without having to know them
You're handsome!!!! THANKS!!!
My computer has crashed many times and unity always saves for some reason
Unity 2021.3.9f1 not working on mac m1 24... Anyway, thank you
@quoctuanlee3544
Жыл бұрын
I'd had this tool not working. Then I tried reimporting the scripts. It worked! You need to import both cs files at the same time: AutoSaveConfig and TarodevAutoSave
During my viewing of this video, I realized I hadn’t saved in 5 hours… Yea this is now going to be in every project I ever do from now on…
@Tarodev
2 жыл бұрын
I still use it in everything
I wasted all of my life savings on pasta... It was worth every Penne.