11 Things You (Probably) Didn't Know You Could Do In Unity

  Рет қаралды 156,972

Game Dev Guide

Game Dev Guide

Күн бұрын

Пікірлер: 199
@tharsis
@tharsis 2 жыл бұрын
Another tip I like using. If you're a fan of auto properties to do something like: public float SomeValue { get; private set; } (For those that don't know, this means that anything in code can see this value, but only the class that owns the object can set it, kind of like a 'secure' field/variable.) Say you want this to be editor inspectable? Normally, you would instead have to add a private field alongside it that's marked as [Serializable], and the inspector deals with that field rather than the property. This also means you'd need to type out the property in its full form rather than the shorthand above, adding getters and setters that interact with that field, which can take a bit of time and be a bit ugly. Thankfully, C# supports a method of applying attributes to the hidden field auto properties create, and this can be done by adding 'field:' before the attribute name. For example: [field: Serializable] public float SomeValue { get; private set; } With that alone, your property now appears in the inspector, can be read by any code, but can only be set in the inspector or the owning class. This is handy for things like broadcasting an entities stats (HP, MaxHP, Strength, etc) and allowing those values to be seen and used by a UI and other objects, but only the inspector and the owning class can modify them (So if something wants to apply damage, it needs to still go through a 'DealDamage' method on the class rather than adjusting HP directly. It can still see the HP value though if it needs to act based on it, for AI or whatever).
@Eclipsed_Archon
@Eclipsed_Archon 2 жыл бұрын
that's really useful to me actually, this deserves to be in a follow-up video if we get one.
@Eclipsed_Archon
@Eclipsed_Archon 2 жыл бұрын
I got this working as: [field: SerializeField] public float SomeValue { get; private set; } Just in case anyone else happens across this. For some reason [field: Serializable] was throwing an error, but with [field: SerializeField] it's working perfectly.
@DodgyAussies
@DodgyAussies Жыл бұрын
This is actually the first time someone's mentioned the get:set properties with an actual use case
@marcusaasjensen
@marcusaasjensen 2 жыл бұрын
Quick tip: You can use equations inside textboxes of the transform inspector. For example, if I want to move my object from 125 to 135 on the x axis, I can type in the x axis "x+10" to move my object to 10 steps further.
@ulicesisaia
@ulicesisaia 2 жыл бұрын
And this is also useful when you want to scale something without touching the "Scale" field on the Transform, you change the width and height multipliyng the values for the same factor and it will keep the aspect ratio: like "Height: 504 * 1.2/Width: 213 * 1.2"
@foncode101
@foncode101 2 жыл бұрын
Same in #blender 😉
@arthurjvnb
@arthurjvnb 2 жыл бұрын
I think any field using a number support equations :D
@__dane__
@__dane__ 2 жыл бұрын
This is something I’ve always known since day one so it’s always interesting seeing people discover it
@Mempler
@Mempler 2 жыл бұрын
I use that one all the time. I learned it through blender lol
@neetosu2853
@neetosu2853 2 жыл бұрын
this video is many years worth of editor scripting knowledge baked under 15 minutes what an absolute BANGER
@JasonStorey
@JasonStorey 2 жыл бұрын
I'll be honest, Normally these lists are things I already know... but I learned 2 things this time! There was also a couple of new things in the comments section too. Great video as always, It's always great when you learn new things about the tools you use daily.
@Ryan-ww7un
@Ryan-ww7un 2 жыл бұрын
Preserving polymorphism in lists using [SerializeReference] was especially eye-opening for me personally.
@Erveon
@Erveon 2 жыл бұрын
Polymorphic lists was something I had wanted for a while, didn't know it was actually possible, thank you! Took me a little bit of fiddling and Googling to get it to work for my use case but it works like a charm and makes things a lot cleaner than making new scriptable object instances every time I need a different variable
@bin9294
@bin9294 2 жыл бұрын
Can you share your code to me? I really want this but this tutorial does not provide complet code to me.
@junaidywijaya
@junaidywijaya Жыл бұрын
The only problem for me is that the list doesn't specify which class the element belongs to, it just says element 0, element 1, and so on
@ligofleyens9131
@ligofleyens9131 2 жыл бұрын
Worst than not knowing some of the tools you did show here, is that I had already forgot those were still existing and could have helped me out. Thanks for the reminder!
@Wolfos530
@Wolfos530 2 жыл бұрын
I love that even after 12 years of using Unity, I can watch one of those videos and still learn something new.
@ZeeKhar
@ZeeKhar 2 жыл бұрын
- In Transform we can enter equation for irrational numbers, ex (3^0.5)/2, we can also use the module operator like 5%2. - Surface snapping (Shift+Control) and Vertex snapping (V) are very useful to place object in the world. - We can rotate an object by previously selected vertex (with vertex snapping). - in Transform, when clicking on the letter X Y Z and drag left and right we can change the value.
@ChaineDeQualite
@ChaineDeQualite 2 жыл бұрын
Please do more of these. This is amazing.
@JudahMantell
@JudahMantell 2 жыл бұрын
At 5:00 and on, you show your Day/Night cycle script in the inspector. This looks super useful and I'd love a tutorial on it!
@harshmudhar96
@harshmudhar96 2 жыл бұрын
Half of these points are simply awesome. MovedFrom, Backup, Change inheritance of component.
@mrtruman4339
@mrtruman4339 Жыл бұрын
THANK YOU. I've been wanting to make polymorphic lists for so painfully long. I was praying for that to appear here. This will make things so much easier.
@Nialyah
@Nialyah 2 жыл бұрын
I'll be honest, atleast half of these I didn't know about. Haven't tackled much with GUI and custom inspectors but I really want to get into this some more, so thanks for this video. I'll try my hand at some of these :)
@mementomori7160
@mementomori7160 2 жыл бұрын
Thank you for not using shorts format, they may be good for some things, but not for educational/informational videos, you can't fast forward, go back, etc etc(actually it's 2 2nd time I'm writing exactly this) and with programing and similar stuff, those functions are needed
@Devorkan
@Devorkan 4 ай бұрын
there's an option to see shorts as "real" videos using the "Enhancer for KZbin" extension
@mementomori7160
@mementomori7160 4 ай бұрын
2 years too late mate, already using it! Tho I still prefer not having to see shorts even in a normal format
@RobinDoesUnity
@RobinDoesUnity Жыл бұрын
Thanks for this video, very informative!
@נרידוד-ס3צ
@נרידוד-ס3צ 6 ай бұрын
thanks , after some years of programming in unity, you have just taught me new things
@joshbishop
@joshbishop 2 жыл бұрын
Holy cow, the [SerializeReference] attribute was literally something I needed for my tool I'm making right now. Thanks a million for this video my dude, it's been enlightening!
@darkman237
@darkman237 2 жыл бұрын
Milanote is absolutely worth it!!! We've been using it for months.
@Eclipsed_Archon
@Eclipsed_Archon 2 жыл бұрын
Never knew about polymorphic lists! I need this often (more than I should) and this is kind of a game changer for me, so thank you.
@NameUnknown-
@NameUnknown- 2 жыл бұрын
The polymorph list is really cool, also the expandable editor with a reference details
@ethancodes7134
@ethancodes7134 Жыл бұрын
I watch videos like this pretty frequently and they are always very disappointing. This one was a pleasant surprise! I've worked in Unity full time for 4 years and I didn't know any of these except the last one! Thanks for the useful tips!
@LautaroArino
@LautaroArino 2 жыл бұрын
Really good tips. Several that I didn't know that I will surely use. Thanks.
@logiis6
@logiis6 2 жыл бұрын
I am glad I didnt skip the add. I was looking for this exact thing :D
@alfonzo6320
@alfonzo6320 8 ай бұрын
that serialize reference keyword blew my mind. i had that exact issue in the past and couldn't figure out how to solve it! Thanks a lot !
@GrahamOfLegend
@GrahamOfLegend 2 жыл бұрын
Omg omg omg, the embedded scriptable object editor is a GAME CHANGER!!!! This list is golden, thank you so much
@harrogance3404
@harrogance3404 Жыл бұрын
The component swapping holding inheritance is a lifesaver ❤
@ArmanNobari
@ArmanNobari 2 жыл бұрын
Indie dev with 1 shipped title here, and the last tip about CTRL+. blew my mind. Had no idea. Thank you so much for making this compilation!
@nightmarexgr7252
@nightmarexgr7252 2 жыл бұрын
Me randomly watching this one week ago thinkining there is nothing new i would learn... me today remembering about this one inheritance replace script thing and coming back to see how to do it, cheers
@LegoDinoMan
@LegoDinoMan 2 жыл бұрын
Locking and duplicating the inspector helped me out so much, thank you!
@Tomatech
@Tomatech 2 жыл бұрын
For the ExposedScriptableObjectAttribute, there was a missed step about creating a dummy editor for all monobehaviors to fix a bug in unitys UI. The referenced thread in the description includes this step
@personalgamedevyt9830
@personalgamedevyt9830 2 жыл бұрын
The debug mode in the Unity is something I did not know about, and will use more. Thank you!
@joaquinfraustoalfarorocco8177
@joaquinfraustoalfarorocco8177 2 жыл бұрын
i just started doing a multiplayeer game and i just made a LateStart() coroutine everytime i needed something like that, but the start itself being a coroutine just makes it cleaner! i never could have thought of something like that its amazing! loved this video
@coderaven1107
@coderaven1107 2 жыл бұрын
I only knew the one with the locked inspector tab, everything else was completely new to me :D Sick Video dude!
@venenifer3569
@venenifer3569 2 жыл бұрын
2 Days ago I had to extend LayoutElement and Slider for some extra functionality and didn't know about Tip 6, wasted a lot of time copying and pasting values to the new components. Great video as always!
@ДмитрийГуляев-н5н
@ДмитрийГуляев-н5н 8 ай бұрын
It's so cool! A lot of useful attributes and code hacks! I've been working at Unity for the last 5 years, but I didn't know much about it!
@Evert-JanN
@Evert-JanN 2 жыл бұрын
Yay! I made it into a GameDevGuide video :) at 2:58
@skydrag4227
@skydrag4227 2 жыл бұрын
Same here ! Feeling proud right now.
@DevilN94
@DevilN94 2 жыл бұрын
You can hover over any window in the editor and press Shift + Space to maximize it, then press Shift + Space again to return the window to it's original state. I use this for the Game window instead of "Maximize on play" option, because when I pause the game the windows stays maximized
@richiebee33
@richiebee33 Жыл бұрын
Amazing tip, thanks 🙏
@notlaw1567
@notlaw1567 2 жыл бұрын
These tips are really handful when it comes to developing. There were a few that I've found really useful and I didn't know about. Thanks for this video!
@alexdacat
@alexdacat 2 жыл бұрын
Swapping inherited components in debug is super cool! Going to use that one forsure
@MuftahDev
@MuftahDev 2 жыл бұрын
one quick tip: by hover over any method or variable and click CTRL + Left mouse button, you can access where this method was written even if it's from another class
@TylerGreen
@TylerGreen 2 жыл бұрын
Some of these were some really nice tips!
@PanzerTF
@PanzerTF 2 жыл бұрын
Tip 6 is super useful, I wish I knew about this when extending my UI buttons.
@lemonade3532
@lemonade3532 Жыл бұрын
Very humbling video. I have much more to learn
@Tomatech
@Tomatech 2 жыл бұрын
There were a lot more things I didnt know than I expected, i might need to rewatch it again another day so that I dont forget
@darkModeYT
@darkModeYT 2 жыл бұрын
Preserve polymorphism!!! Oh my God! You are a legend!!! God blessed me when I subscribed to you! Thank you!! Thank you!!❤️❤️❤️❤️❤️❤️
@elvismd
@elvismd 2 жыл бұрын
Amazing tips! Especially the one where we can get icons from the editor! It helped me a lot!
@MassimoRough
@MassimoRough 2 жыл бұрын
Bonus tip: switch from VS to jetbrains rider. It will significantly improve your coding experience and performance.
@HAWXLEADER
@HAWXLEADER 2 жыл бұрын
I said the same but replaced that with VScode.
@saniel2748
@saniel2748 2 жыл бұрын
I didn't see any performance improvement when downloaded trial version of rider over VS2022
@Eclipsed_Archon
@Eclipsed_Archon 2 жыл бұрын
The benefit I got from Rider was actually less than from VScode, but I have to wonder how much this differs depending on how you utilize your namespaces and how big your project is
@TESkyrimizer
@TESkyrimizer Жыл бұрын
what if im not making enough money from gamedev to justify the expense lol
@JesseTheGameDev
@JesseTheGameDev Жыл бұрын
Rider was really frustrating for me to start with. It has needed a lot of customization to be good for me.
@drottningu
@drottningu 2 жыл бұрын
You did a great job picking new tips! I only knew 3 of those.
@bischoffdev
@bischoffdev 2 жыл бұрын
The list serialization tips are really cool!
@xAjido
@xAjido 2 жыл бұрын
Jason Weimann did a similar video recently with many of the same tips, though this one had a couple extra which were nice.
@pandaengine
@pandaengine 2 жыл бұрын
Thank you for this! Now I can stop worrying about using inheritance because I may change the script in the future.
@dhedarkhcustard
@dhedarkhcustard Жыл бұрын
I've been using unity for about 5 years and I'm so annoyed with this video, only because I would have prevented so much stress and frustration if I knew these. And I mean, ALL of these I didn't know, and I'm really good at googling. Thank you so much for this.
@richiebee33
@richiebee33 Жыл бұрын
Awesome video! Thanks for the tips 🎉
@MaharbaRacsoChannel
@MaharbaRacsoChannel 2 жыл бұрын
The Properties... menu item it's also available for assets in the project view, for GameObjects in the hierarchy, and for any object assigned in an object field. With this, I never need to lock an inspector anymore. I also prefer this to embedding an editor inside another: I just right-click in an object field and select Properties..., It takes a lot less space.
@majeric
@majeric 2 жыл бұрын
I didnt know the Editor icon ones. So Thanks!
@supercyclone8342
@supercyclone8342 2 жыл бұрын
Extremely helpful! Just yesterday I set up a new enemy and then realized I needed to change it from my EnemyBase class to a child turret class, but I thought I needed to re-set up everything. I'm also pretty sure I ran into a situation where I could've just made Start a coroutine XD
@nv7287
@nv7287 2 жыл бұрын
finally the equivalent to blender secrets list Yay! Yes please make mooooooorrrre
@francescagreetham1804
@francescagreetham1804 2 жыл бұрын
Double inspector windows!! Why didn’t I know this before. So useful
@Cyberfoxxy
@Cyberfoxxy 2 жыл бұрын
that one with script swapping is pretty neat. Previously the way i solved this is by opening the scene in a text editor and swap out the script GUID.
@bike_n_fish
@bike_n_fish 2 жыл бұрын
Until the 7th I was like "Is that even tips ? Everybody know that" and then you drop da bomb - Thanks for thoses they're pretty usefull
@thefoundationentertainment
@thefoundationentertainment Жыл бұрын
11:34 you can also rename all the references of the class by directly opening the .asset file of the ScriptableObject asset in the notepad
@DevDunkStudio
@DevDunkStudio 2 жыл бұрын
Great one! Actually quite some things I did not know and will keep in mind when developing!
@javiermorin3110
@javiermorin3110 2 жыл бұрын
Your videos are awesome. This one here is particularly helpful.
@thetra00
@thetra00 2 жыл бұрын
very well made and thanks for these little helpers!
@awesomemike3857
@awesomemike3857 2 жыл бұрын
I knew 6 of them and didn't know 6 of them So awesome video
@ferdinandkasangati5089
@ferdinandkasangati5089 2 жыл бұрын
thanks with milanote bro, really brilliant
@Thomason1005
@Thomason1005 2 жыл бұрын
uh, tips 6 and 7 are 🔥. that would have saved me quite some time in the past...
@rafaaccr
@rafaaccr 2 жыл бұрын
Really, really, reeeeeaally useful… as always :)
@ClipperRoad
@ClipperRoad 2 жыл бұрын
I want to be a game dev so badly, thank you for a great video - subbed and looking forward for more tips and guides in Unity and Blender, any recommendations for learning would be greatly appreciated 🙂 thank you
@workflowinmind
@workflowinmind 2 жыл бұрын
Very cool one, I would add the UnityCsReference as it's THE thing I keep referring to
@adamodimattia
@adamodimattia 2 жыл бұрын
This video alone made me subscribe! Thanks
@unityvictor787
@unityvictor787 Жыл бұрын
in 7:37, How you create button of "Add Cow" in inspector?
@Alzimovich2
@Alzimovich2 2 жыл бұрын
Great uncommon tips, a new subscriber here
@broganking9830
@broganking9830 2 жыл бұрын
OMG number 6 blew my mind!
@Icewind007
@Icewind007 2 жыл бұрын
This video is rich with new stuff for me! I want to remember it all!
@kmud7750
@kmud7750 2 жыл бұрын
More videos like this! Great video.
@Mouton_redstone
@Mouton_redstone 2 жыл бұрын
very useful, thank you very much !
@KyleHarrisonRedacted
@KyleHarrisonRedacted 2 жыл бұрын
The main thing I learned, is that Unity's custom editor API is far more in depth than I ever gave it credit for
@SilverAura
@SilverAura 2 жыл бұрын
Not sure if Unity fixed this or not but your tip on duplicating the inspector is one I found was incredibly useful... till I discovered it was the reason my editor kept crashing. You're better off sticking strictly with the "Properties" method.
@shankdixit
@shankdixit Жыл бұрын
Superb content..Thank you !
@DavidVille
@DavidVille 2 жыл бұрын
Implementing auto save correctly is a lot more complicated than just a checker. For example I often work with multiple scenes open, and One of them is my "working now scene" that I do want to be saved, but the other ones, I may or may not make changes to them temporally, that I do not want to be saved (mostly because other people is working on them on source control) Auto save would have to be enabled "per scene", that would work.
@LilayM
@LilayM 2 жыл бұрын
Nice! Had no idea about lots of these.
@mrb-lm4nv
@mrb-lm4nv Жыл бұрын
Question: in a foreach loop, how do you see if the current object the loop has selected has an equal element number to a certain int. that didnt make sense Basically: foreach(GameObject item in Items) { if(*that items element* == int) { } }
@ofir9999
@ofir9999 2 жыл бұрын
You are awsome! New and different tips!
@brunogattai9262
@brunogattai9262 2 жыл бұрын
How to add custom buttons in toolbar like "Scene Collections" shown at 09:18 ?
@deminedddd
@deminedddd 2 жыл бұрын
Check out the toolbar extension video on the channel!
@waflicek
@waflicek 2 жыл бұрын
Hello, where could I find that documentation in 2:14 ? Can't find it. Great video!
@johnmedlong55
@johnmedlong55 2 жыл бұрын
"or, in laymen's terms, preserve the polymorphism inside of the list." made me laugh considering who would qualify as a laymen watching this video. Thanks for the great tips!
@mattw_dev
@mattw_dev 2 жыл бұрын
Thank you Matt!
@Kabeza00
@Kabeza00 2 жыл бұрын
thanks for that valuable data!
@apubetico
@apubetico 2 жыл бұрын
i think i saw it in a video of yours but how you handle the hierarchy groups? because making everything child of a clean empty makes me use local cordinates and so..
@R3zShark
@R3zShark 2 жыл бұрын
Ctrl+Period? 12:42 Never heard of doing that but I always use the "Show potential Fixes" option whenever I hover my mouse over the code.
@ChadGatling
@ChadGatling Жыл бұрын
The shortcuts were causing problems in play mode when I was trying to use control + number to assign unit control groups. I had to rebind those shortcuts and it saved me a lot of annoyance.
@leonardo6631
@leonardo6631 2 жыл бұрын
Great video!
@btarg1
@btarg1 2 жыл бұрын
4:20 there is an asset on the asset store (and probably multiple alternatives on github, youtube etc) that will properly autosave for you every time you enter play mode or otherwise on a timer. It should be built into unity really
@DagothDaddy
@DagothDaddy 2 жыл бұрын
Are there any resources to help make a tactical pause menu. Something like Mass effect on PCs pause and issue commands UI in unity?
@dondernerd
@dondernerd 2 жыл бұрын
A nice one if you're making a custom inspector, propertydrawer, or something along those lines is ObjectNames.NicifyVariableName. It'll clean up your variable name to make it more presentable in the UI :)
@eladiozro
@eladiozro 2 жыл бұрын
You can also collapse all the items in the selected hierarchy if you fold while pressing ALT
@JayaTemara
@JayaTemara 2 жыл бұрын
Damn nice info, thanks mate
@Meowzors
@Meowzors 2 жыл бұрын
How did you put the "Scene Collections" button up in the toolbar?
@GameDevGuide
@GameDevGuide 2 жыл бұрын
Check out the toolbar extension video on the channel!
@__ian94__
@__ian94__ 2 жыл бұрын
10:33 does anyone else sometimes get the "ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint" error when expanding SOs?
@furrygecko
@furrygecko Жыл бұрын
I get it 100% of the time. Haven't been able to get the SO editor within an editor working yet. If anyone has a resolution to this, it'd be a lifesaver.
Creating A Replay System In Unity
19:39
Game Dev Guide
Рет қаралды 6 М.
20 Advanced Coding Tips For Big Unity Projects
22:23
Tesseract
Рет қаралды 204 М.
Wall Rebound Challenge 🙈😱
00:34
Celine Dept
Рет қаралды 21 МЛН
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 45 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,6 МЛН
Build a Scrolling Progress Bar in Rive
14:18
DesignCourse
Рет қаралды 998
Unlocking The Power Of Unity's Scriptable Render Pipeline
21:05
Game Dev Guide
Рет қаралды 226 М.
10 Things You NEED to Be Doing in Unity
11:40
Tarodev
Рет қаралды 137 М.
5 Things You Can Do To Make Games Like A Pro In Unity
9:45
Game Dev Guide
Рет қаралды 116 М.
10 Unity Tips You (Probably) Didn't Know About
7:09
Sasquatch B Studios
Рет қаралды 8 М.
Watch This Before Working on a Big Game in Unity
18:44
John Leorid
Рет қаралды 301 М.
Unity Code Optimization - Do you know them all?
15:49
Tarodev
Рет қаралды 199 М.
10 Unity Tips You (Probably) Didn't Know About
8:58
Sasquatch B Studios
Рет қаралды 13 М.
Speed Up Compile Times in Unity with Assembly Definitions
9:54
Game Dev Guide
Рет қаралды 93 М.
6 DEVS Make a GAME without COMMUNICATING! (HARDCORE edition)
20:12
Blackthornprod
Рет қаралды 1,7 МЛН
Wall Rebound Challenge 🙈😱
00:34
Celine Dept
Рет қаралды 21 МЛН