Unity Architecture for Noobs - Game Structure

  Рет қаралды 197,903

Tarodev

Tarodev

Күн бұрын

Пікірлер: 363
@Laurynaspupsta
@Laurynaspupsta 2 жыл бұрын
Great video, but there seems to be a mistake in StaticInstance class On the Singleton class, there should be a return method inside the if (Instance != null) statement. Otherwise, the base.awake method is still being called, and the previously created static instance ref is overriden by the StaticInstance class's Awake method. But still, the structure is amazing. Keep it up!
@Tarodev
@Tarodev 2 жыл бұрын
Yup, you're 100% right. At the time I must have thought Destroy would effectively act as a return (how crazy of me). Thanks for picking that up!
@nathalieraffray306
@nathalieraffray306 2 жыл бұрын
@@Tarodev You should pin this comment! I definitely spent some time confused because there was no return statement and thought I was misunderstanding something. Great video though
@Tarodev
@Tarodev 2 жыл бұрын
@@nathalieraffray306 you're right. Done!
@ihugyoucuziloveyou
@ihugyoucuziloveyou Жыл бұрын
@@Tarodev or anybody else can write the correct code please? Not sure where to put what.
@urselhorst9253
@urselhorst9253 Жыл бұрын
thank you for mentioning this. I ran into an issue with the missing return and wasn't 100% sure where to fix it
@Pixelhurricane
@Pixelhurricane 2 жыл бұрын
I think one of the most important tips I received in this video was during your intro, "as you learn as a developer it will adapt and evolve to your style" I had been confusing myself trying to force other developers' styles of architecture into my projects, what I *should* be focusing on is taking advice from other devs to evolve a style that's suitable for the way that *I* think. Really enjoyed this video, learned a handful of other helpful things as well!
@Tarodev
@Tarodev 2 жыл бұрын
That really is the most important takeaway from the video so I'm glad that part stuck.
@JasonStorey
@JasonStorey 2 жыл бұрын
Great Video, I follow a very similar structure. The only real standout differences is that those "separator" style gameobjects with dashes etc, if you put them on the editor only layer they will be auto stripped from the project which cleans up the build hierarchy, and the other one is that I personally try to avoid "resource loading" style code at runtime if possible. In the case of populating a repository of units etc, if they are not going to be loaded from a remote source I have all the info I need at edit time to populate the arrays myself. So I usually write a little helper function that uses the search syntax in unity to find, load and populate an array with matching content. so for example, a context menu button that has _array = ResourceLoader.Load("t:prefab l:unit boss") which would then find all prefabs with a unit label with boss in the name, get their resource guids, resource load them and pop them into the array for me. Oh, and instead of using the _ on the scripts folder I make a generic "_project" folder that I treat as the "real" root. so it has its own data folder for scriptables, its own prefab folder etc. That being said, I subscribe to the belief that the unity project view is NOT a folder structure but an asset database and so I don't try too hard to wrangle the folder structure, but empower myself to be able to use it through targeted naming and use of labels and other search utilities. Again, great video. It's always a joy to see other people orbit some of the same patterns and practices, it means we are all coming to similar conclusions so their must be a kernel of value in them.
@Tarodev
@Tarodev 2 жыл бұрын
What great insight, Jason. I love your videos by the way! Your editing is so clean and satisfying 🤩 It is nice seeing us all reach similar conclusions. I'll be interested in what you think about my slightly off-market state machine video coming out soon.
@Nova04550
@Nova04550 2 жыл бұрын
Jason Storey you are an inspiration!
@RealisiticEdgeMod
@RealisiticEdgeMod 2 жыл бұрын
11:06 You are violating programming principles 101. Composition should be used instead of inheritance. This has been the standard practice for 27 years. ( the gang of four book was published in 1994).
@Tarodev
@Tarodev 2 жыл бұрын
@@RealisiticEdgeMod Wholeheartedly disagree, and this is also coming from somebody who uses composition over inheritance 90% of the time. In addition, overusing composition simply to avoid inheritance is even worse than not using it at all, in my opinion. As this is a unit base and I know EVERY unit will take damage, it makes sense as a function, derived from inheritance. Over-engineering is the death of many projects, especially for new devs, which is who this video is for.
@RealisiticEdgeMod
@RealisiticEdgeMod 2 жыл бұрын
@@Tarodev I agree that sometimes inheritance is better but in this particular instance you really should use composition.
@mrOverYeff
@mrOverYeff 2 жыл бұрын
Can you make a video on decision making? Like good questions to ask yourself and how to resolve them. Example: should this class be a monobehavior, a scriptable object or OG c#? Flowed by some indicators you can look for and an example / fixing a bad example
@mrOverYeff
@mrOverYeff 2 жыл бұрын
I'd really like this cause I feel like i know a lot of concepts but use them in the wrong situation :)
@mrOverYeff
@mrOverYeff 2 жыл бұрын
Another good question: should I even ask this question on this project? Indicators: size, complexity
@jkRatbird
@jkRatbird 2 жыл бұрын
Yes! I really need this too! Roughly understand what everything does but still really hard to grasp the what the purpose of each one is.
@mrOverYeff
@mrOverYeff 2 жыл бұрын
@JonontoastTo: depend on your project: yes and no the answers most definitely depend on your project however there is some good questions that overlap and guide you in the right direction. To: questions about questions, I recently had a sw project (not gamedef) myself, where I was asking myself how do I optimize this and how do I handle this being in a bad state. Which in itself where bad questions, cause by trying to resolve problems that could exist I created problems that actually existed. And I feel like this is decision making. I hope you at least partially get my point now? And thx for the detailed response ^^
@edward3190
@edward3190 2 жыл бұрын
Use scriptable object whenever possible. it makes your project easy to manage, debug and test.
@ZahhibbDev
@ZahhibbDev 2 жыл бұрын
It's quite rare too see a tutorial on architecture, so thanks a lot for this! Happy holidays mate!
@windwalkerrangerdm
@windwalkerrangerdm 2 жыл бұрын
This was something I seriously needed as a self-thought developer, and there are few (maybe no other) examples of architecture out there that's in my league... Thank you very much and you've got a sub.
@greghcarr8192
@greghcarr8192 2 жыл бұрын
I've been hopping around between different Unity tutorial channels and I think I finally found my home. This video has been incredibly helpful for me, thank you.
@Tarodev
@Tarodev 2 жыл бұрын
Welcome home Greg
@TaAnderson-Google
@TaAnderson-Google 2 жыл бұрын
Informative video - Check Entertaining host - Check Clearifying annotations - Check Showing clicks & folders - Check Just enough detail - Check Bookmarked chapters - Check Sample Unity package - Check Tarodev videos - THIS IS THE WAY.
@Tarodev
@Tarodev 2 жыл бұрын
Damn! I checked all the boxes on this one. Although: Zoomed in code for mobile screens: Unchecked
@TaAnderson-Google
@TaAnderson-Google 2 жыл бұрын
@@Tarodev Trust the person that spots their own errors, tells you about them, and moves to correct them. That is the person that you don't need to follow up on or worry about. That is integrity and it is far too rare and so very priceless. You're personal/KZbin checklist is problaby much larger. Your example is a legacy that others will look up to in awe. Well done. Happy New Year to you!!
@Tarodev
@Tarodev 2 жыл бұрын
@@TaAnderson-Google You're making me blush :D Have an amazing 2022 my guy! By the way, I'm premiering a video, starts in 4 mins!
@Caphalem
@Caphalem 2 жыл бұрын
Always happy to see a Unity video promoting some proper programming patterns
@willycampos6101
@willycampos6101 2 жыл бұрын
Happy Holidays! Pretty cool content Taro. a few things that might also help to keep in mind: 1. Not that i condone the use of singletons, but there is a better way of making your abstract Singleton class. I know Unity recommends 'Singleton : MonoBehaviour where T : MonoBehaviour', but in this case you can actually put any MonoBeaviour in place of T. Given that some coders might actually try to do this. its better to put an extra constraint do the following: 'Singleton : MonoBehaviour where T : Singleton', now you can only put T's that inherit from Singleton. 2. Instead of having that Dictionary, did you know that you can actually use ScriptableObjects as Enums, big benefits: They're Drag and Drop-able, no need to recompile if anyone wants to add another "Enum", designers can do it, no need to modify code, and you can use a generic to get the Reference too. Instead of using 'GetExampleHero(ExampleHeroType t)' you can do this 'GetExampleHero()' if you went the inheritance way, but if you are a bit more ninja, you can go the composition way, which will probably disregard the use of this system XS. 3. Try to avoid using or putting too many things in the Resources folder, everything that is in the resources folder will get loaded into memory every time you load a scene, even if those assets are never used (slow scene loading times, and big ram usage). You're already using ScriptableObjects, no need to have them there. you can make a ScriptableObject Holder that holds the references to all ScriptableObjects (a bit more work, but totally worth it). Another thing you could do is simply use Addressables, a much better way of accessing objects and assets with the benefit of not saturating your memory necessarily, and wit the big benefit that it can also work somewhat like streaming assets, if you have an update, no need to make another build, simply make a new AssetBundle and done, yes they can be downloaded/updated at runtime, they're pretty cool! Hope this helps X)
@Tarodev
@Tarodev 2 жыл бұрын
Great writeup, Willy :)
@Liamneedham29
@Liamneedham29 11 ай бұрын
This is the exact tutorial I've needed. I find it so easy to come up with ideas for games and visualize what that game will end up looking like, and impossible to understand any of the structure I need to build. Every tutorial has their own structure that they follow without explaining, or they stick to very basic stuff without ever teaching you how to implement a structure. I now know what I'm missing, what I need to learn about and what I can figure out through trial and error. So instead of searching "how do I actually make the games I design", I know that I can at the very least build a structure with this in mind, tweak the structure to suit the game better if need be, and start actually making the games. It's like being a painter and never being taught how to use a canvas or a brush - sure you can throw the paint at a sheet of paper and call it art, but if you want to paint something in particular, you need to know what frame you are working within.
@kdeger
@kdeger 2 жыл бұрын
As mentioned these types of systems can cover %90 of the gameplay, great structure sample. Also maybe you can make another video for state machine samples and addressables(instead of resources I feel like it's more convenient). Great video as usual, oh oh also I'm going to become a Tarobro now!
@Tarodev
@Tarodev 2 жыл бұрын
Thank you so much for your support man!
@alexcubed4270
@alexcubed4270 2 жыл бұрын
I like that you put the commment at 15:18. I recently switched to using that approach and i really like it. It makes it much easier to find the stuff you need when working on a feature, especially since the different file types all have their own icons, so if youre in a hero folder, its very easy to locate all the sounds for that hero for example
@Nova04550
@Nova04550 2 жыл бұрын
I think I would worry where to put files that could belong to more than 1 feature, but idk, never tried that way, but you can always mix and match both paradigms
@codered_dev2
@codered_dev2 Жыл бұрын
taro is the ultimate game dev,i hope my channel grows just a big!
@sprungo3968
@sprungo3968 2 жыл бұрын
This is great content man. There's so much out there for the beginner it's really refreshing to see well made tutorials that cover this intermediate kind of content.
@Tarodev
@Tarodev 2 жыл бұрын
Thanks mate! I'll have some more intermediate to advanced stuff coming shortly!
@tylerheenan9393
@tylerheenan9393 2 жыл бұрын
Wow. Busts out ALL the awesome tricks it took years for me to learn and a few new ones! Amazing, mate.
@halivudestevez2
@halivudestevez2 2 жыл бұрын
I will need to repeat it several times, and slow it down. Very valuable info included! Worth to watch it and learn, think it over.
@xxann55
@xxann55 2 жыл бұрын
Been using Unity for about 2 weeks now and this is what i needed! Watching the video and reading through the code/assets set off so many light-bulbs in my head, I finally have a high level overview of how a simple game would flow. Thank you so much!
@Tarodev
@Tarodev 2 жыл бұрын
You're welcome mate!
@helenvillian
@helenvillian Жыл бұрын
I'm new to Unity and making games but work in data & analytics professionally. This video has helped FAR MORE than any tutorial. I really need to understand a good workflow and architecture before diving into learning Unity itself and C#, from this video I feel I have a good base to start on a game when coupled along with a detailed game plan of what I want the end product to look like and have. Thanks so much!
@merlinduty7546
@merlinduty7546 Жыл бұрын
That's probably the single most helpful video on unity I've seen. This is the things you struggle with building from blank slate and step by step. Normally you just start with something, then at some point realise you need some kind of system to do X, than try to build that , conceptualize , look up specific tutorials , fail miserably because there are just tutorials about smaller problems saying 'Oh yes at this point we will do this just like this, but it's not proper, so mind that', look up forum questions, can't read beacause $$anonymous$$ , and finally be able to do what you wanted to after working through debugging sessions. Later you will realise you need some other system and refactor because you get this unorganized abomination. This video avoids so much pain, acting like something where to look up on how to implement X base concept and organize your smaller problems. Amazing. Could be just me since I have experience with software development, just not game development. I am not overwhelmed by the code snippets themselves, I can imagine you don't really worry about these things when you don't come from software engineering. However still kind of sad to see the use of this Don't Destroy and kill new versions pattern. My dev senses are all tingly with implementing that. Doesn't seem proper at all. Was looking forward to see a solution that avoids those.
@BlueJeebs
@BlueJeebs 2 жыл бұрын
Nice, there were a few things I've been doing but some of them went completely over my head. I've heard more and more about scriptables so inevitably I'll need to dive into them. Thanks for the rundown
@Tarodev
@Tarodev 2 жыл бұрын
Few spoken mistakes in this video with corrected annotations. Needed to rush it out before "Merry Christmas" became too irrelevant heh. Love you guys! Enjoy.
@rohanmanchanda5250
@rohanmanchanda5250 2 жыл бұрын
Or you could have just erased the part where you say Merry Christmas? The only thing would be the bush stuck on your head but I think it'll be taken as modern art...
@dwried
@dwried Жыл бұрын
After leaving a game behind for a good while, and then going back to it, I started to question my logic on the game flow big time. This video just happened to show on my recommended watch videos shortly after. Thank you for the video. You have given me some insight on ways to look at the mess of code in games.
@synchaoz
@synchaoz 2 жыл бұрын
Big thanks for this. Not a lot of hierarchy/file/folder structure insight videos out there. How to manage all your files and crap seems to be one of those things nobody really spotlights. I suppose because, as you yourself mention, it's a highly subjective thing. But even so, as someone new and still learning, the value of seeing how more experienced devs manage their game structure should not be underestimated.
@Tarodev
@Tarodev 2 жыл бұрын
Glad you found it helpful Sean :)
@anaibrahim4361
@anaibrahim4361 2 жыл бұрын
tamara adviced me to watch this video and it was really answering all my questions thanks a lot sir for your efforts to simplify the game dev work by highlighting thos principale step
@Seizen
@Seizen 2 жыл бұрын
Wow, really good video. Most of the videos on KZbin doesn't care about those details you mentioned. Subscribed.
@pixeldevlog
@pixeldevlog 2 жыл бұрын
Loved the video, these types of videos are very rare, as an experienced programmer, this was very helpful for me.
@dominicwindle5707
@dominicwindle5707 2 жыл бұрын
Your Unity tutorials are excellent. As a DotNet developer trying to learn Unity I really appreciate how you explain things
@niranjanwagh5767
@niranjanwagh5767 Жыл бұрын
This is the video I was waiting for for long long time. I will be watching it several time in upcoming days to understand each part. Please consider making more videos like this in future. In each video you can deep dive into Managers, Setup, Enviroment, Canvases and System. I know you have videos on most of these topics already. But most of them are oriented for turn based games. Again Thanks for this video. It helped me overcome my initial barrier of game development journey.
@midniteoilsoftware
@midniteoilsoftware 2 жыл бұрын
Brilliant idea putting all our DontDestroyOnLoad objects under one parent object!
@sn0man
@sn0man 2 жыл бұрын
SO appreciate this video. Just starting out architecture and structure is hard to get started. Going to rewatch this a couple times and go through the project until it all makes sense.
@Tarodev
@Tarodev 2 жыл бұрын
Glad it could help you on your way :)
@Ez-_-69.
@Ez-_-69. Жыл бұрын
really felt when he said 5:19 heart touching
@un_holysix
@un_holysix Жыл бұрын
First of all, thank you, my friend! Second, for every one that is starting coding right now, or trying to, and don't know what to do, is like completly lost into what things to study and where to start, I humbly invite you to read about my short journey into software development world. Even if it's still short (about 2 years) I think this may help you. Time ago I tried to do unity games a couple times, and I did it till a certain point, then my code starts getting unreadable and I can never advance... Now I code rest api in java and live from this. There is an achitecture, of course. Every language has a lot of technics. Clean code, solid, ddd, clean architecture in general. And i didn't know this when I start coding. Even now, I'm not able to code something expandable without this. (Honestly, I think no one can) And that's something that we do not realise until we got experience and most times someone have to give you a little push and open your eyes. I was looking for something to start doing this right that time in unity. I just needed a little help, but I could not find this for free in the internet, until a couple weeks ago, with your video... And dude, works like a charm! That's exacly what I needed and I can assure all of you that THIS is the most important thing withing all languages. Even more important than code at all. Boy, no matter what you do, you need achitecture or you will get lost. Your code will break and you'r gonna have to call an alchemist, or even an exorcist to fix it for you. Of course it may vary within each language, but the *way of thinking* is the most important thing when talk about coding clean and architecture. And that is simply the best tutorial I found. For real! Generally i have to read a bit from some place, then a bit more from another and another, watch some videos and read huge books till i learn the content. But its all here, perfeclty separated for topics. I just felt compelled to set aside a little time and come here to thank you. Hope this can reach millions of people and you can keep spreading your knowloge out. I wanted to use youtube feature to give you a "Thanks", but its not available... You will get farther and farther, keep going, we jrs need you 😂❤ My best regards, Manolo Dias.
@behnamrasooli8801
@behnamrasooli8801 2 жыл бұрын
Great tutorial. However, this folder structure works better for small projects. As your project grows, finding your stuff becomes harder. A more scalable solution would be feature-based folder structure. For instance, a Player folder for player's stuff including texture and 3D models.
@Tarodev
@Tarodev 2 жыл бұрын
I had an annotation at the end describing this folder structure :)
@xDTHECHEMISTx
@xDTHECHEMISTx 2 жыл бұрын
Man you make me want to start my whole base project all over again and be neater this way. Its efficient
@Tarodev
@Tarodev 2 жыл бұрын
Big decision. A re-write always feels nice
@FernandoMirabile
@FernandoMirabile 2 жыл бұрын
Nice video! Love it. One thing I'd add for the next time (Maybe?) is to create a folder for your project to avoid mixing folder with any asset store importing you have. For example, myProject folder contains all my scripts, materials, etc. While at the same level of myProject folder I can contain any imported folder from the asset store. This helps me clean a bit and organized better, since sometimes you can mix imported things with yours and that could end in a headache
@Tarodev
@Tarodev 2 жыл бұрын
Plus, doing this allows you to easily add assembly references!
@bshibishi5889
@bshibishi5889 2 жыл бұрын
I just got into this and I was actually wondering about this kind of thing, didn't even care to search because I thought no one would care to post. Subscribing was the right choice haha Thanks.
@ThePancakeJedi
@ThePancakeJedi Жыл бұрын
Excellence! Can’t wait to try this out.
@rpamungkas13
@rpamungkas13 2 жыл бұрын
This channel is really a gold mine for anyone learning Unity. It answer many questions on the back of my mind when learning this Engine :o
@bunnybreaker
@bunnybreaker Жыл бұрын
I love everything about this video. Subbed for the head tree and intro statement alone 😉👍🏽
@Tarodev
@Tarodev Жыл бұрын
Welcome aboard ❤️ 🎄
@datablob
@datablob 2 жыл бұрын
I learn something with every video, even with the beginner stuff, thank you!
@mhrohan917
@mhrohan917 2 жыл бұрын
Just Finished my Game (with clean code) had been Digging into Code structure for a month now.. Finally have a good understanding.. Now you show up with THIS. ALL THOSE I LEARNED ARE IN THIS VIDEO 😓😳
@Tarodev
@Tarodev 2 жыл бұрын
Ah... I wish I could have released this earlier for you 😜
@VirtuwolfGames
@VirtuwolfGames 2 жыл бұрын
Looking festive af bro! Thanks for the Architecture advice. The neater it is, the sweeter it is
@ExplorationTV
@ExplorationTV 2 жыл бұрын
Thank you Tarodev for the Unity Architecture for Noobs - Game Structure video, extremely helpful on my aspiration journey to game and film rendering development.
@PeterAlexay
@PeterAlexay 2 жыл бұрын
Wow. This is exactly what I wanted. Thank you for this. 🎄🍾🎉
@Mikelica69
@Mikelica69 2 жыл бұрын
Thanks for this knowledge!!
@c6jones720
@c6jones720 2 жыл бұрын
as a programmer its nice to see this sort of content. Ive seen loads of unity tutorials that amount to clicking a few items in a menu, this leaves me asking the question where is the code to wire it all together?
@Tarodev
@Tarodev 2 жыл бұрын
Here it is baby
@SuperTungbi
@SuperTungbi 2 жыл бұрын
Just what i'm looking for, omg thank god i have you 😍😍😍
@ItsMrFabry
@ItsMrFabry 2 жыл бұрын
More of this Great video! I saved it in my playlist for later! have a good holiday!
@chioxin
@chioxin 4 ай бұрын
Thank you so much for this. This is SUPER helpful after all the other stuff I've gone through and learned. =) I've been trying to find this to help with my sphegetti code. You are a hero =D ( to me at least XD )
@danylatulippe
@danylatulippe Жыл бұрын
I know I'm late to the game, but I figured I'd comment anyway. Excellent video with very informative content. I really enjoyed it. One thing though... In your HeroUnitBase class, I find your inheritance troublesome, in particular for the method ExecuteMove. Considering the code in the base is extremely important for the flow of the game to continue, I would transform this method a bit. First, I would remove the virtual to make sure nobody ever overrides it. You want that code to run. However, in that method, I would call a protected abstract method, let's call it ExecuteUnitMove(). So, by making that simple change, you make sure _canMove is always set to false AFTER the actual move and all classes inheriting from HeroUnitBase MUST implement ExecuteUnitMove. And now, no need to call the base class because the base class takes care of itself. You can also apply that approach for the OnMouseDown method and, by using a state or any other logic, call Move, Attack or Dance. ;) Again, great content. My suggestion could be a bit advanced for "Noobs", but I think it provides a better approach to the given problem (the game flow) without making it overly complicated.
@MM-24
@MM-24 2 жыл бұрын
Small request / consideration - This would be amazing if the code was posted to github or some easily viewable place. This would make this amazing tutorial a tad more accessible
@KasperGrnbakChristensen
@KasperGrnbakChristensen 2 жыл бұрын
This is good advice for new game devs, can recommend 👍
@legittaco4440
@legittaco4440 2 жыл бұрын
IMPORTANT note for the Singleton class. It says if(Instance !=null) Destroy (gameObject); base.Awake(); this DOES NOT work as intended. Destroy does not stop code execution, the object gets destroyed at the end of the frame. Which means base.Awake(); still gets called and your instance becomes null even if you don’t want it to. Instead do if(Instance !=null){ Destroy(gameObject); return; } base.Awake(); hope this helps
@ObviousDev
@ObviousDev 2 жыл бұрын
Great video! I always struggle with architecture so that was very interesting :)
@RobertGercia
@RobertGercia Жыл бұрын
Thanks for sharing this tips. Really helpful to me.
@KeyboardKrieger
@KeyboardKrieger 2 жыл бұрын
Good timing, I'm going to restructure my current project in January, so some input was very welcome 😊👍
@Tarodev
@Tarodev 2 жыл бұрын
Good luck with that! It's always a big task restructuring mid way through 🙏
@KeyboardKrieger
@KeyboardKrieger 2 жыл бұрын
@@Tarodev yeah, that's why I'm not already on it and have to finish the MVP beforehand -_-
@hectorcruz92
@hectorcruz92 2 жыл бұрын
I love your videos! This video is just what i was looking for to have a quick understanding of how to structure my games. Keep up the videos i know you are making someones life a lot easier!
@dmitrywroclaw9165
@dmitrywroclaw9165 2 жыл бұрын
Cool! Thank you and Happy New Year!
@ridlr9299
@ridlr9299 2 жыл бұрын
Rather than putting your system prefab in every scene, you can use a single additive scene (in some cases).
@artourprice2435
@artourprice2435 Жыл бұрын
Thanks for sharing. Very helpful!
@geri4367
@geri4367 2 жыл бұрын
Really valuable video! Videos about patterns, project architecture and so on are always fun to watch Nice festive hat btw, gives me some TF2 vibes :P
@Tarodev
@Tarodev 2 жыл бұрын
Yes indeed 😂
@robertjenkins6323
@robertjenkins6323 2 жыл бұрын
Great video. I found this really useful as a beginner to unity. Thanks Tarodev :)
@SojoTaku
@SojoTaku 2 жыл бұрын
Noice!! Merry Christmas
@Tarodev
@Tarodev 2 жыл бұрын
Ho ho ho
@paulglosemeyer2451
@paulglosemeyer2451 2 жыл бұрын
this video changed my life :D
@VEOdev
@VEOdev 2 жыл бұрын
Many new developers don't pay attention to project structures or good practices and they don't realize it until it is too late and until their project is so big and gets overwhelming and hard to debug or hard to add new things or change something because everything is spread everywhere. I see some developers uses Game Manager to do almost everything game related such as handling timer, rewards, UI things .... and this lead such to a messy code at the end, it may not effect small projects but for medium games it is very important
@martinnyberg4941
@martinnyberg4941 Жыл бұрын
“Destroy Child, which actually sounds horrible!” 😂
@AbuSalmanAngoli
@AbuSalmanAngoli 2 жыл бұрын
That is really helpful. Thanks man, lemme give you a hug!
@Tarodev
@Tarodev 2 жыл бұрын
Gimme gimme
@svendpai
@svendpai 2 жыл бұрын
Another great video, thank you for taking the time to cover this :)) A lot of tutors skip this part of development
@razanomer10
@razanomer10 2 жыл бұрын
Thank you. You are fantastic!
@johnreycasingal6954
@johnreycasingal6954 2 жыл бұрын
This helps me a lot!! Thanks
@alexfu1734
@alexfu1734 2 жыл бұрын
Awesome video! Inspire me a lot.
@chusatorra96
@chusatorra96 2 жыл бұрын
Love this, thank you very much!!
@brianmcalpine822
@brianmcalpine822 2 жыл бұрын
Thank you @Tarodev, being new to Unity, this is very beneficial! p.s. I love your hat
@soverain
@soverain 2 жыл бұрын
Great video. The one thing I'm not a fan is you advocating for the use of singletons for state management. At first glance it seems easy to implement and use, but as the project grows, it becomes a nightmare. I made the choice some years ago to restrict my use of singleton to the following: - I really need to get engine callbacks (start, update, etc) - I don't manage state in them (like a Gesture Daemon, it gets inputs, other objects can "listen" but not modify) Most of the time, I'm good with scriptable objects or regular C# singletons (or just static classes for that matter). I never looked back and never encountered that "ho, I need to add 15 singletons game objects to this scene if I want to test it without launching the whole game" again.
@Tarodev
@Tarodev 2 жыл бұрын
You'll notice I only use one singleton in this video, for my persistent system root. What I do use a lot are just static instances (I named it wrong originally, but I added a code annotation where I renamed it 'staticinstance'.
@n8dev
@n8dev 2 жыл бұрын
I’d potentially avoid nesting a ton gameobjects like you have just to clean up your hierarchy, as anytime one of the children moves it will recalculate it’s position based on that of all of its parents which is an unnecessary performance cost imo. Obviously this is a tutorial for new devs and this is easy and works fine pretty quickly in most situations, but if you’re more experienced and looking for a better alternative I’d look into a multiscene workflow, which comes with the same benefits of splitting up your hierarchy with the addition of many, many more. On the topic of folder structure, I’ll do something similar to what you did, except I have everything that’s “mine” in Assets/-Source- or Assets/_Project, which allows me to separate third party assets into Assets/Plugins Not trying to knock you or anything, just thought I’d share lmao. Great video!
@libberator5891
@libberator5891 2 жыл бұрын
Hey n8dev, do you plan on uploading any more videos any time soon? 👉👈
@n8dev
@n8dev 2 жыл бұрын
@@libberator5891 yupp, this week hopefully
@Tarodev
@Tarodev 2 жыл бұрын
Interesting, I was just chatting with somebody who uses the "_Project" (or in his case "_Game") convention. The idea saddens me as I like to use root as... root, but totally see the benefits. By multiscene do you mean each one of my 5 subcategories would be it's own scene and loaded additively? That would indeed provide a lot of benefits, I'll look into it! (although I'm assuming the performance hit of nesting objects is so insignificant it's irrelevant)
@n8dev
@n8dev 2 жыл бұрын
@@Tarodev Yes, that’s exactly what I mean by multi-scene (perhaps a video idea down the road?) In the professional Unity game dev world (from my research and inquries) a multi-scene workflow is standard due to all of the other benefits. I haven’t profiled, but I’d guess in many cases, yeah, the performance hit of nesting objects is pretty insignificant, but this probably changes when you’re working on a larger project with many, many of said nested objects.
@Mushele
@Mushele Жыл бұрын
very helpful Video, I have like 30 projects that I completely abondoned becouse of how messy they became(not only in unity), over these years I developed some helpful habbits that I try to obey but still didnt find the one ideal architecture to rule them all :DD
@msj6894
@msj6894 2 жыл бұрын
Awesome! Thank you soooo much!!
@nightcode8470
@nightcode8470 2 жыл бұрын
great work~ thx for sharing your knowledge with us~ I'll share mines too. A class that holds all the enum call settings. A class that holds all the event delegates call EventHandler this makes my project so much tidier. Also instead of doing scene 1 -> scene 2 -> scene 3, I learn that you can do a persistent scene with all those singletons manager in it, and have it controll load and unload of scenes 1/2/3. Which is like the sub scene system in ECS. and yes, I agree these are very opinionated, so~~~ yup~ leave it if you dont find helpful~ cheers~ and Merry Christmas~
@Tarodev
@Tarodev 2 жыл бұрын
Thanks for dropping some extra tips 😊
@halivudestevez2
@halivudestevez2 2 жыл бұрын
I put numbers to the Project Folder names, this way I can make a sorting order for those folders.
@Tarodev
@Tarodev 2 жыл бұрын
Great tip!
@PauloHSousa237
@PauloHSousa237 2 жыл бұрын
Great video
@TheIronicExistence
@TheIronicExistence Жыл бұрын
Loved this video thank you
@_g_r_m_
@_g_r_m_ 2 жыл бұрын
That was so much usefull information, specialy the singleton class
@Betruet
@Betruet 2 жыл бұрын
Great useful video. Subbed. Merry Christmas and happy new year. Thanks for putting in the effort.
@Tarodev
@Tarodev 2 жыл бұрын
Tha ks for the patreon support mate ❤️
@Betruet
@Betruet 2 жыл бұрын
@@Tarodev hard work pays off ;]
@r1pfake521
@r1pfake521 2 жыл бұрын
I agree that putting the stats on the SO is cleaner, but you actually could get the stats from the prefab without spawning it, because you can access the prefab GO components directly just like with a spawned GO, just be careful to not modify them, otherwise you will change all objects that are later spawned with the modified prefab ;)
@Tarodev
@Tarodev 2 жыл бұрын
This gives me PTSD from my early unity days where I would change prefabs in code unintentionally (because I was a noob). I stay clear of reading data from prefab references nowdays.
@andrewsneacker1256
@andrewsneacker1256 2 жыл бұрын
Very usefull content! Thank you!
@goldone01
@goldone01 2 жыл бұрын
Great video - very nice to get some inspiration! As you said, it's a very opinionated topic - I personally prefer to use components over inheritance (given that's how unity is inherently designed). So rather than having a base class with stats and health, I'd add a stats and health component to the units that need it. The main benefit is that if I decide I know want different types of stats for enemies and heroes I can just swap out that stats component rather than having to change all my base classes.
@Tarodev
@Tarodev 2 жыл бұрын
This is a fantastic workflow and I also use composition most of the time. I figured it was a bit too abstract for new devs though so I stuck with basic inheritance. I should add composition to my tutorial to-do list!
@goldone01
@goldone01 2 жыл бұрын
@@Tarodev Yes a video about composition would be great, and would have helped me out a lot when I started out in unity. A lot of unity tutorials lead you very much down a monolithic monobehaviour path which is fine for small games but few explain how to make the step up to bigger games.
@IndieDX
@IndieDX 2 жыл бұрын
Thanks for sharing!!
@anaibrahim4361
@anaibrahim4361 2 жыл бұрын
really nice and clean code and structure let say we have bunch of scene in our game should i create a manager to each one of the scenes or , just make it as singleton
@Knuckles2761
@Knuckles2761 Жыл бұрын
Unity should introduce empty blank hierarchy objects without transform component, just for scene structure. No transform is for lesser calculations of global-local positions whenever something moved. Those empty objects should be totally virtual, ignored by compiler.
@Entikai
@Entikai Жыл бұрын
Hey Taro, would you ever make a Udemy style long intermediate tutorial where you show how to make a game the right way! Not the prototype-grade code, but the production-grade.
@zenmasters_games
@zenmasters_games 2 жыл бұрын
Cool video bro. New sub here
@Tarodev
@Tarodev 2 жыл бұрын
Welcome aboard brother
@Vambr
@Vambr Ай бұрын
For your normal Singleton classes, wouldn't you want the virtual Awake method to do a null Instance, Destroy check? or did I miss something in the video? 🤔
@AlanAlan-bv9yg
@AlanAlan-bv9yg 2 жыл бұрын
Quality tut
@occularmalice
@occularmalice 2 жыл бұрын
Similar to others I make a "_Project" folder under Assets which is the root for all of my content. That way I can exclude everything in Assets/* from source control (since I don't want to be checking in third party assets) and the _Project folder pops everything to the top of the tree for me (except when some asset author decides to use the "_" character in their stuff). The other big thing I do organizationally is to use the a "Runtime" folder for the regular "scripts" (it's code, it's not scripts anymore that was the old days) and "Editor" for the editor scripts. One more thing that's missing from your examples, namespaces!! Very important. Can't stand asset authors that don't use them and they help avoid conflicts like a "Player" class (that everyone has).
@Tarodev
@Tarodev 2 жыл бұрын
I also use a _Project folder varient nowadays 😊
@bdd740
@bdd740 2 жыл бұрын
All the best.
@farfi55
@farfi55 2 жыл бұрын
Nice video, just one critique, when showing code it's better to increase the font size to make it more readable fin peasants on mobile :)
@Tarodev
@Tarodev 2 жыл бұрын
You're right and I forget every single time... I need a check list or something 😅
@bocdagla
@bocdagla Жыл бұрын
First of all great tutorial on architecture in Unity; But i've recently seen in the "unity open projects" that they are using a "Scriptable Object" architecture in order to work with added scenes and i fail to find that anywhere else. It would be cool if you could make a video on that matter!
@bennettkeller3226
@bennettkeller3226 2 жыл бұрын
Nice video for beginners. I would say my only wish was that a lot of these pieces didn't need to inherit from Monobehaviour. I think that's a big drawback to setting up a project in the likeness of this video. Similarly the singleton which is heavily overused in projects, represented by a Monobehaviour, will encourage newer devs following this to keep creating gameobjects instead of just using a static class, or simply creating a singleton using a more standard method. To sort of further drive that idea home, the non-persistent version destroys itself implicitly when the scene changes, since the base doesn't clean up in OnDestroy(), but in OnApplicationQuit(), which means players can still make calls through the public static instance even after it's destroyed. That's a rather big issue/pitfall even if the example is supposed to be simple.
@OmegaF77
@OmegaF77 2 жыл бұрын
14:55 Anakin approves!
@Tarodev
@Tarodev 2 жыл бұрын
Hah 😂
20 Advanced Coding Tips For Big Unity Projects
22:23
Tesseract
Рет қаралды 185 М.
POV: Your kids ask to play the claw machine
00:20
Hungry FAM
Рет қаралды 22 МЛН
Самое неинтересное видео
00:32
Miracle
Рет қаралды 2,9 МЛН
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 240 МЛН
Как мы играем в игры 😂
00:20
МЯТНАЯ ФАНТА
Рет қаралды 3,1 МЛН
10 Things You NEED to Be Doing in Unity
11:40
Tarodev
Рет қаралды 132 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,5 МЛН
Software Architecture in Unity
7:13
Jason Storey
Рет қаралды 118 М.
The 6 Design Patterns game devs need?
24:20
Jason Weimann
Рет қаралды 368 М.
Unity3D Managers vs Controllers
12:06
Jason Weimann
Рет қаралды 57 М.
2 Years Of Learning C | Prime Reacts
22:24
ThePrimeTime
Рет қаралды 288 М.
POV: Your kids ask to play the claw machine
00:20
Hungry FAM
Рет қаралды 22 МЛН