Комментарии:
You get it! Im an Android Developer learning Game Development and struggling to find good videos on architecture and keeping things testable. Nice to see example on how these principles are applied in Unity development. Thanks a lot
Ответить== for float realy bad idea ;)
ОтветитьI got distracted wondering if it's more efficient if you have a lot of timers in your code that you register them with a central class that has your Timer class. If you implement it so that it's costly to add, by placing new timers into an ordered list (or part-ordered or whatever, lots of optimizations possible). Then, in the update loop, you only need to make one check for the soonest timer to fire. when it fires, you pop it off, and keep repeating the check on the new soonest for any other timers that should fire until there aren't many more that should fire.
Ответитьthanks for this awesome helpful tutorial yes we need more this kind of video... may be I am too late
ОтветитьIs the community link down?? any updates !! would be very much intrested in joining that ..
ОтветитьI wish there were more content like that on YT as game architecture is the stuff everyone should learn before starting developping a real game.
If you start a game without thinking about your architecture, there's a point in your progression where you will be forced to spaghetti code and your game will become more and more unmaintenable as it grows.
Found a bug ? Good luck to identify it if you didn't put any layers in your code logic.
Thanks for this video man
Thank your video,it is really useful😊
ОтветитьTwo years latar and it still helps :D thank you for this tutorial!
ОтветитьI actually dont like UnityEvents. It feels like coupling. And we can't really trace it down like in IDE. Since Unity 2021+ also has very long compile times.. It really feels better to just use Actions.. And UnityEvents are only Scene referenced. So any prefab that spawns later wont be able to subscribe to it. :(
ОтветитьWhile watching the video I thought it was 1.5x speed lol
ОтветитьI don't know much or have much exposure with unit tests, but the idea seems intriguing. The large majority of time I spend programming isn't spent on the writing of code itself, its more the debugging and playtesting of the game. I wonder how much of that time I could cut down on through unit testing?
The thing is, there seems like a lot of situations where unit tests don't really tell you a change needs to be made or an error occurred. Like with playtesting and tweaking AI behaviour, you kind a need to play the game to get a feel of how the entity is behaving to know if it needs a change or not. But maybe it could help avoid straight up error and bugs, like yesterday I spent 45 minutes trying to fix a null reference error, only to realize that it was a totally different variable that was throwing the error, and after that I fixed it in 5 seconds.
That dino is indeed quite dapper...
Ответитьgood content. you would really top it off if you stepped up your audio quality and video aesthetics
ОтветитьI need to make the database for a unity game, and the game has a bunch of different data, attributes, etc. I want to store these as one huge string VARCHAR(300) in SQL, should I do that, or should I make like 30 different columns in the database? which one is more efficient?
ОтветитьI didn't ubderstand any of this haha. Maybe I'll come back to this later.
ОтветитьI’m just learning about events in unity and I’m always seeing events being subscribed and unsubscribed to. In the timer example, would you unsubscribe to the OnTimerEnd event using -= in an OnDestroy/OnDisable method? Or am I completely off base?
ОтветитьLooks really useful and I may use some of these. I'm mostly a hobbyist so most of my time is used on getting things to work. It's nice to know that I can still do that part and then come back and refactor my code using this type of architecture.
ОтветитьThanks for the video. You used to have a Udemy course going Thru the Open Project 1? I saw the link on the codecks cards but I can't find it. Was removed? I would really like a tutorial/course that goes thru the design of that project, looks really well made.
Ответитьwhy not using fixed update? then he would not calculate like 60 times per second but in the physic step. ergo more performance? because you use deltatime anyway
ОтветитьDipper Dino
ОтветитьYour parameter "duration" for the timer class should be "durationInSeconds".
It's also a good practice to use OnDestroy and remove the delegates you assigned and nullify some instances you created and no longer need it.
Would be interesting to see a situation where 1 Monobehavior ticks many different objects, since it's a common performance situation with Unity where you avoid many objects updating individually (to avoid reflection call of Update).
I need to learn about events and function invoking and getters and setters,
Wish I had like a roadmap to progressively acquire the right programming tools
makes perfect sense!
ОтветитьMake tps multiplayer mobile game plz
Ответитьmake simple complex
ОтветитьWouldn't a timer be best used with a coroutine? Ticking a bunch of timers every Update feels excessive
ОтветитьI highly recommend playmaker...
ОтветитьI recommend people read The Pragmatic Programmer. You will thank me.
ОтветитьIs there a reason you initialize the UnityEvent to null?
ОтветитьWhy do two separate checks for whether the timer is 0? You check once for if the time is 0 and then later you check if it's greater than 0 with the else setting it to 0 if it runs lower. But you don't really even need the first check. The second check handles both conditions. The same is true if you checked less than or equal to 0. In that case you would set the timer to 0 and then return.
ОтветитьA lot of people who make tutorials don't really know C# and have no other experience with it apart from simple Unity scripting. So they really don't know anything about OOP and design, just attaching MonoBehaviour scripts to GameObject. Kind of bugs me when I'm watching tutorial videos to learn the Unity API and no one seems to know basic C# concepts lol. But this video was refreshing. I try not to use many MonoBehaviour objects unless they actually need to hook into Unity directly. I've been thinking about creating my own sub-engine to connect to Unity and manage some extra things and deal with syncing multiple threads.
ОтветитьThis was great. Having the example at the real world use case and benefits was nice. I wonder if leading with a few of those before getting into the how-to of it would be better format, set that hook kinda deal. Thanks.
ОтветитьWhere are your SOLID videos? Looked through your channel but not finding them.
ОтветитьFirst of all, thanks for all your tutorials and hard work! Much appriciated!
I have a question to ask.
In your "Timer" class, you're passing Time.deltaTime as an argument so you won't have to use the "UnityEngine" namespace, but in your "Movement" class you're clearly using it, what's the different? Why using the namespace in one and not the other?
Thank you, i was needing a video about software architecture in video games, so THANK YOU :D
ОтветитьI'd like to see this same thing, but also some stuff about dlls
ОтветитьGreat video, easy to understand and follow. Explanation is simple and to the point. Deserves a sub 👍
ОтветитьQuite an informative video, as well as enjoyable. Thank you!
ОтветитьSorry, the video is good and all, but the title is misleading.
ОтветитьGreat example of using design pattern! Keep it up
ОтветитьThis is a pretty cool way of setting up things
ОтветитьWow, timer, nice.
But what would you do if this timer is a part of mobile game where users each time fold the game window once they got a new message in some kind of messanger?
Timer will be paused as well as game itself.
How to handle this by the proper way?
As a professional c# developer looking to learn unity, it's infuriating watching all of these tutorials making poor architectural and design choices and never mentioning anything about how this might look in a production system (or doing it so quickly that it isn't helpful). Thank you for this!
ОтветитьI would pay for a full course on this topic
ОтветитьBut all this boilerplate code makes it really hard to understand what stuff does.
ОтветитьMore videos like this please!!!
ОтветитьI get this error in Visual Studio on the line for "timer.OnTimerEnd += HandleTimerEnd();" : Cannot implicitly convert type 'void' to 'System.Action'. If I make the method in the Unity class the following: "private Action HandleTimerEnd() { onTimerEnd.Invoke(); }" that works, but I still get an error on that method saying "not all code paths return a value" since it needs to return an Action (I have no idea what that is).
I'm also getting an error on the following line: "onTimerEnd.Invoke();" in the HandleTimerEnd() method in the Unity class (TimerBehavior in your code; I just put this code in my Unity MonoBehavior class, without the wrapper). The error is that "onTimerEnd" is null because it's never instantiated in the Unity code (or wrapper in your code), it's just defined as "private UnityEvent onTimerEnd = null;"
My code is the same as yours, I looked at your code on GitHub. I just put the code you have in your TImerBehavior class right into my Unity MonoBehavior class.
Could you give an overview of how to set up for TDD and Clean Architecture within Unity?
I'm coming into Unity Games Development as a highly experienced C# developer for Web and Desktop Applications. I've been highly concerned that Unity seems to break C# Coding Standards with regards to naming conventions; intellisense looks horrible, and there's no XMLDocs. Also, the accepted use of public fields is highly concerning, as it breaks encapsulation.
So far as I can see, this would be your structure:
Domain: POCO classes, base abstraction layers.
Application: Business Logic for specific projects.
Infrastructure: Unit Tests, Integration Tests, Assembly-CSharp (Unity UI Adaptor).
You should be able to swap out your Assembly-CSharp front end, for your Unit Test Suite, and be able to test all the business logic; none of which depends on Unity. Then integration tests give coverage for your implementation of all the Unity code-behind.
But, where would you write your first uncompilable tests? I prefer Plan-Do-Study-Act to Red-Green-Refactor, it's easier to understand and explain. But, what's the best way to implement that PDSA pattern within Unity? Is it better to start with a failing integration test, and fall down through the layers?