Unity Script Templates - Changing default script content

  Рет қаралды 29,314

Tarodev

Tarodev

2 жыл бұрын

// Update is called once per frame
I freaking get it, stop showing me!
Don’t put up with the standard Unity templates, make your own! Change the default content in created assets.
Go sub to Jason Storey: / jasonstorey
❤️ Become a Tarobro on Patreon: / tarodev
=========
🔔 SUBSCRIBE: bit.ly/3eqG1Z6
🗨️ DISCORD: / discord
✅ MORE TUTORIALS: / tarodev

Пікірлер: 98
@Finalldrace
@Finalldrace 2 жыл бұрын
Better than a fixed namespace is, to add: #ROOTNAMESPACEBEGIN# and #ROOTNAMESPACEEND# Then you can set the Namespace inside your Project (Project Settings/Editor - C# Project Generation - Root namespace)
@Tarodev
@Tarodev 2 жыл бұрын
That is indeed better. Good tip!
@nguyeninhtai5244
@nguyeninhtai5244 2 жыл бұрын
Can you show the example? I can't get it :((
@ColdOneK
@ColdOneK Жыл бұрын
If you like short ones, I've got two for you. 1 - You can save the files you make with the font asset creator for Text Mesh Pro, so you don't have to remake them every time you start a new project. 2 - If you're like me, when developing a new system, you might make a bunch of new scripts at once. Like say while making an inventory system. You'll need a base item - derivative item types - an inventory - etc. Making them one at a time is slow, as each will force unity to do a reload. Just open up a script, and deliberately create an error. You won't have to go through a reload each time you make a new script. Saves a lot of time.
@10-Years-At-Least
@10-Years-At-Least 2 жыл бұрын
I've been needing this for the last 6 years
@kingbling7571
@kingbling7571 2 жыл бұрын
Almost 20K, Let's gooo!! Also Code Monkey mentioned your channel in one of his live streams!!
@Tarodev
@Tarodev 2 жыл бұрын
omg WHAT? What did he say??
@kingbling7571
@kingbling7571 2 жыл бұрын
@@Tarodev Someone asked him which Great Unity YT Channels he follows and he starting listing some and you were one of them as well :P He also mentioned he recently found it and that it had some amazing videos that one should watch if they have time. Ik this is great n all, but I know you can reach over 100k in coming time! Let's goooOoOoOo
@Tarodev
@Tarodev 2 жыл бұрын
@@kingbling7571 Mind blown. I've been watching CM for so long and it's insane to think he knows I exist, lol!
@kingbling7571
@kingbling7571 2 жыл бұрын
@@Tarodev yup, must be an amazing feeling. Well u do deserve some recognition after all. Also don't forget that I exist when you grow large, jk lol
@Tharky
@Tharky 2 жыл бұрын
Jason also helped me out on some stuff, he's great :) Thanks for the tip bro!
@Shahmuradov
@Shahmuradov 2 жыл бұрын
Simple and straight to the point. Thank you!
@diligencehumility6971
@diligencehumility6971 2 жыл бұрын
Yeah this channel is quite good
@Tarodev
@Tarodev 2 жыл бұрын
Thanks boys
@zenmasters_games
@zenmasters_games 2 жыл бұрын
Always learning something new. Your channel is the next best thing since sliced bread. 🍺
@pr0_mt
@pr0_mt 2 жыл бұрын
Thank you for the amazing tutorials
@Tarodev
@Tarodev 2 жыл бұрын
You're like text mesh pro, but backwards!
@PitiITNet
@PitiITNet 2 жыл бұрын
Such a small thing but making life so much better :D. Love it!
@diligencehumility6971
@diligencehumility6971 2 жыл бұрын
Yeah I found out about this some years ago. What is annoying is, you have to do this ever time to update unity or download a new version. The templates should be shared so you can use the same templates
@Tarodev
@Tarodev 2 жыл бұрын
Absolutely agree. I suppose it's not because they may change bits and pieces from the templates.
@Vastlee
@Vastlee 2 жыл бұрын
Was going to reply the same thing. There's no reason for it either. Unity could easily store it in the user profile of the machine. Such a simple fix.
@zaurin9650
@zaurin9650 2 жыл бұрын
Super dope! Also really cool that you know Jason Storey, he's really cool imo.
@Tarodev
@Tarodev 2 жыл бұрын
He's alright I suppose
@midniteoilsoftware
@midniteoilsoftware 2 жыл бұрын
This is great for when creating new scripts. But is there a template I can change so it doesn't put the annoying private keyword when adding new methods (e.g. Awake, OnEnable, etc.)?
@crazyconan28
@crazyconan28 Жыл бұрын
Another benefit with this would be adding a symlink if you have multiple versions, that way you would only have to change one file/folder once to have it applied to all versions of Unity you have downloaded. Thank you for the quick tip Tarodev!
@omritahar9048
@omritahar9048 2 жыл бұрын
So i'm saving it and trying to replace the original but it says access to the path is denied. Care to help?
@bambidalc513
@bambidalc513 2 жыл бұрын
What is the font type you use for the notes in the video? Nice tip btw, thx!
@kubstoff1418
@kubstoff1418 2 жыл бұрын
pretty cool, tho I usually add a blank class from rider since it has a better project view and shows which assembly is the parent
@GameDevNerd
@GameDevNerd 2 жыл бұрын
Good tip, but you can make Visual Studio templates too for Add New Item menu ... super handy thing to know. I create all my new .cs files in Visual Studio anyways.
@nikobellic7455
@nikobellic7455 2 жыл бұрын
Or you can put the "ScriptTemplates" folder inside your "Assets" directory, and changes the scripts as your liking, then just restart the editor. And you are done. It does not matter you update unity or move your code to a different system it should just work.
@IlPandax
@IlPandax 2 жыл бұрын
Yes but only for a specific project, right?
@nikobellic7455
@nikobellic7455 2 жыл бұрын
Yes, its not for all project or system wide, so it also may not be ideal in all cases, but its still another way to do it. Pick whichever method is suitable.
@KeyboardKrieger
@KeyboardKrieger 2 жыл бұрын
Even though I use the same templates in all projects, this solution seems to be less hacky and more straight forward.
@joaolira7
@joaolira7 Жыл бұрын
Makes more sense doing your way. Every project can have a different namespace, for example.
@joaolira7
@joaolira7 Жыл бұрын
@Niko Bellic Does the script must have a specific name?
@sapientunderground
@sapientunderground 2 жыл бұрын
Cheers, no more correcting new scripts before I can start working with them!
@PixelbugStudio
@PixelbugStudio 2 жыл бұрын
That was really cool✌️
@BagumkaTV
@BagumkaTV 2 жыл бұрын
For me it was empty folders in c:\Program Files\Unity, but found it in my home folder c:\Users\USERNAME\Unity\VERSION\Editor\Data\Resources\ScriptTemplates\
@rafarodriguez4765
@rafarodriguez4765 2 жыл бұрын
It is very cool, but due to being software in constant evolution you are always downloading the next lts versions, and you would have to do it in all of them. Apart from this, one more useful tip. thanks
@epicmcdude
@epicmcdude 2 жыл бұрын
Hey Tarodev, Would you be able to make a tutorial about a combat or text log? Like in those CRPGS (Fallout 2, Baldurs Gate) where you have a small window to the side with a bunch of scrolling text telling you what you hit and for how much damage, or telling you information about an object you clicked on. Thanks for the videos!
@Tarodev
@Tarodev 2 жыл бұрын
Great suggestion!
@guyginat
@guyginat 2 жыл бұрын
Super cool! Regarding namespaces, I think I understand the concept but I never find a reason to actually use them, it feels like it adds an unnecessary extra layer of complexity to your project, and if you are going small indie projects it seems redundant… Would love to see a a video about namespaces and their use. Other than that I am really enjoying your content man, thanks a lot! Everything is super helpful!
@mementomori7160
@mementomori7160 2 жыл бұрын
In short, by using namespaces you somewhat enforce to write cleaner less tangled code. I thought the exact same thing like you some time ago, but now I'm slowly changing it. There is a channel infallible code or something like this, they covered it nicely
@kingbling7571
@kingbling7571 2 жыл бұрын
It acts as a barrier which is always nice when you need to clearly define a line between two different modules n such
@modiddymo
@modiddymo 2 жыл бұрын
Also in larger projects it shows you which modules a given class depends on by giving you a list of using statements at the top of your file.
@jeffmccloud905
@jeffmccloud905 2 жыл бұрын
Think of them like folders/sub-folders of your file system. They are for organization and to prevent naming collisions (imagine two classes named Button or Weapon). They become particularly important on large projects or when you make/reference DLLs
@midniteoilsoftware
@midniteoilsoftware 2 жыл бұрын
kzbin.infosearch?query=namespaces
@YasserSedrati
@YasserSedrati 2 жыл бұрын
AMAZING!
@BlackoutGamingChannel
@BlackoutGamingChannel 2 жыл бұрын
Can you do one of these on namespaces please? I kindda understand them but also i have no real idea what/why/when/where/how. Also, thank you.
@littleknight66
@littleknight66 2 жыл бұрын
how can i learn a littble bit more about script template ?
@-.._.-_...-_.._-..__..._.-.-.-
@-.._.-_...-_.._-..__..._.-.-.- Жыл бұрын
Why did they choose to store the templates in the version folder? This means your templates are lost when you update Unity, which is pretty much every time you start a new project. Why couldn't they store the templates in the AppData folder, along with all the other presets (such as keybinds and layouts)?
@umapessoa6051
@umapessoa6051 2 жыл бұрын
You can also do this without changing the editor default templates by putting it on a special folder inside yout assets folder, this way everyone that works on the project will have it too
@Rovsau
@Rovsau 2 жыл бұрын
Great video! I might add more using statements, so I can delete the ones I don't need. CTRL+X deletes a Line (uses clipboard) Shift+Delete does the same (uses clipboard).
@buzatusebastian2735
@buzatusebastian2735 10 ай бұрын
and shift delete also deletes a line without storing it in the clipboard
@Rovsau
@Rovsau 10 ай бұрын
@@buzatusebastian2735 Thanks! I'll update that in my post.
@buzatusebastian2735
@buzatusebastian2735 10 ай бұрын
@@Rovsau nvm shift del still stores the line in the clipboard wow. Just found that out srry
@Rovsau
@Rovsau 10 ай бұрын
@@buzatusebastian2735 ah lol, I missed that myself xD
@IlPandax
@IlPandax 2 жыл бұрын
That's great! I didn't know that. ;)
@TriCombStudio
@TriCombStudio 2 жыл бұрын
Any clue why Time.deltaTime would not work in my script? It says 'float' does not contain a definition for 'deltaTime' and no accessible extension method 'deltaTime' accepting a first argument type 'float' could be found. Restarted VS and unity, regenerated project files and tried the unity debugger without success. I am stumped... It still works in other scripts. fixedDeltaTime also would produce a similar error if I try to implement it under the fixedUpdate.
@MaZyYTube
@MaZyYTube 2 жыл бұрын
You are in wrong place
@TriCombStudio
@TriCombStudio 2 жыл бұрын
@@MaZyYTube this comment especially proves that with how abundantly helpful it is. My issue was resolved thanks to posting in comments sections though... so high five to people who comment regardless of how ignorant their opinions are for getting the ball rolling!
@MaZyYTube
@MaZyYTube 2 жыл бұрын
@@TriCombStudio its good for you but imagine this video would have full of off-topic comments like this help request / questions it wouldn't make fun to read anymore.. and some bigger ytber already have this and needed to start deleting comments. Do you want it same here? I mean I would understand if this were related to the video. 2. It is harder to help in yt comment section. Better to use unity forum, reddit or discord. It is easier to share code and to analyse it.
@TriCombStudio
@TriCombStudio 2 жыл бұрын
@@MaZyYTube This reply was far more useful than your first comment, I probably could have actually used this advice
@EnemyOTS
@EnemyOTS 7 ай бұрын
thank you for the tip. Now my Unity is creating a new testscript instead and i dont know how to undo the damage.
@crummymudd8625
@crummymudd8625 Жыл бұрын
Thank you -- I've been wondering how to change this for a long time. I'm on Linux, so the path was a little different.
@DanPos
@DanPos 2 жыл бұрын
Excellent vid, those comments are so annoying haha. I may edit it to just get rid of the start and update function straight away too
@ErtBaran
@ErtBaran 2 жыл бұрын
Great 💯 Thanks.
@KeyboardKrieger
@KeyboardKrieger 2 жыл бұрын
Nice one, I will do that at first on Monday xD
@KeyboardKrieger
@KeyboardKrieger 2 жыл бұрын
Maybe it was today and not the following monday, but hey at least it's a monday and I finally used this tip^^
@SkorpionYassine
@SkorpionYassine Жыл бұрын
@@KeyboardKrieger lmaoo
@Shonia
@Shonia 2 жыл бұрын
You can also have multiple templates of that and choose which you want.
@guyginat
@guyginat 2 жыл бұрын
How do you do that?
@Tarodev
@Tarodev 2 жыл бұрын
@@guyginat I'm also interested in how this is done
@Shonia
@Shonia 2 жыл бұрын
@@Tarodev Idk if I can post link here so... Search youtuber "Coding With Unity" and the name of video is : Unity3D - Create, Edit and Rearrange Script Templates
@Shonia
@Shonia 2 жыл бұрын
@@Tarodev Hope it helps!
@jamesfoward7761
@jamesfoward7761 2 жыл бұрын
You can also set the Namepsace via the Edit > Project Settings> Editor > ROOT NAMESPACE
@Tarodev
@Tarodev 2 жыл бұрын
Sure do wish I knew this before I did this video :)
@jamesfoward7761
@jamesfoward7761 2 жыл бұрын
@@Tarodev ^_^ the video is great, I had no idea you could remove those pesky empty Monobehaviors calls/libraries
@kingbling7571
@kingbling7571 2 жыл бұрын
@@jamesfoward7761 does it include the namespace in every new Script u create?
@jamesfoward7761
@jamesfoward7761 2 жыл бұрын
@@kingbling7571 Yes sir
@nguyeninhtai5244
@nguyeninhtai5244 2 жыл бұрын
I can't generate namespace by your way in UnityEdior2019
@thesilentwisp
@thesilentwisp 2 жыл бұрын
Haha thank you. Cool beansss
@goldone01
@goldone01 2 жыл бұрын
It's really useful. The only annoying thing is that you need to repeat it every time you download a new Unity Version
@KeyboardKrieger
@KeyboardKrieger 2 жыл бұрын
If you stay to LTS versions it's only one or two copy & paste a year.
@SolonisRex
@SolonisRex Жыл бұрын
Put them in the directory "Assets/ScriptTemplates". Unity looks for this folder and you can do it on a per project basis. This really is the best way to do it.
@Cloud-Yo
@Cloud-Yo 2 жыл бұрын
Now if only there was a way to not have to repeat this operation with each new version of Unity.
@MaZyYTube
@MaZyYTube 2 жыл бұрын
Yes annoying but you could write a batch or shell file or even with c# to make little automization
@fleity
@fleity 2 жыл бұрын
it's slightly annoying this has to be done for every (new) install of unity. An interesting addition would be to show how to add custom menu entries to create c# scripts using specific templates
@Tarodev
@Tarodev 2 жыл бұрын
You mean like what should already be built in to Unity? Man, I've been wanting this for years!
@fleity
@fleity 2 жыл бұрын
@@Tarodev Yes absolutely! :D It actually doesn't sound that complicated. I feel like I could build that... I might just do that
@fleity
@fleity 2 жыл бұрын
@@Tarodev OH WOW! I didn't knew until a few minutes ago but this has been built into Unity all along already. Just duplicate the script template and give it a new valid name: {SortingIndex}-{MenuItemName}-{FileName}.txt restart unity if it's already open
@iDigvijaysinhG
@iDigvijaysinhG 2 жыл бұрын
Am I really first 😅, and great video, now I will get rid of those start and update methods
@Dorbellprod
@Dorbellprod 2 жыл бұрын
I've been growing quite sick of those default comments.
@Tarodev
@Tarodev 2 жыл бұрын
Now you'll be free of them!
A new way to generate worlds (stitched WFC)
10:51
Watt Designs
Рет қаралды 499 М.
КАРМАНЧИК 2 СЕЗОН 5 СЕРИЯ
27:21
Inter Production
Рет қаралды 577 М.
Pray For Palestine 😢🇵🇸|
00:23
Ak Ultra
Рет қаралды 29 МЛН
Indian sharing by Secret Vlog #shorts
00:13
Secret Vlog
Рет қаралды 51 МЛН
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 95 МЛН
11 Things You (Probably) Didn't Know You Could Do In Unity
13:49
Game Dev Guide
Рет қаралды 147 М.
Turn Python BLAZING FAST with these 6 secrets
5:01
Dreams of Code
Рет қаралды 31 М.
BLENDER BASICS 4 - Transforming Objects
13:25
CG Cookie
Рет қаралды 32 М.
'Faerie' - Unreal Engine 5.4 short film
3:14
Sam Gielen
Рет қаралды 198
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 675 М.
Unity VR XR Interaction Toolkit - UI Menu and Interactions
7:51
Bliz Studio
Рет қаралды 34 М.
Speed Up Compile Times in Unity with Assembly Definitions
9:54
Game Dev Guide
Рет қаралды 86 М.
How I Made $100k On My First Indie Game
7:10
XraiDev
Рет қаралды 192 М.
Rust's Alien Data Types 👽 Box, Rc, Arc
11:54
Code to the Moon
Рет қаралды 132 М.
I Optimised My Game Engine Up To 12000 FPS
11:58
Vercidium
Рет қаралды 480 М.
КАРМАНЧИК 2 СЕЗОН 5 СЕРИЯ
27:21
Inter Production
Рет қаралды 577 М.