Skip to main content
  1. Quick Notes & Explanations/

9. What is UniTask, and What Is It Not?

·1 min· loading · loading ·

UniTask is a framework specifically developed for Unity. Like VContainer, it’s a system that preemptively solves potential issues we might encounter in Unity. It is not a new architecture or a newly discovered technology. It is simply the async structures that have been part of C# for years.

UniTask provides efficient, allocation-free async/await integration for Unity.

•	UniTask and a custom AsyncMethodBuilder can be used to achieve zero-allocation.
•	It makes all Unity AsyncOperations and Coroutines awaitable.
•	It allows for PlayerLoop-based tasks that can replace all Coroutine operations (e.g., UniTask.Yield(), UniTask.Delay()).
•	You can use MonoBehaviour message events and UI events asynchronously.
•	It works entirely within Unity’s PlayerLoop, does not use extra threads, and runs smoothly on WebGL, wasm, Android, iOS, etc.
•	It includes extra features like Async LINQ, Channel, and AsyncReactiveProperty.
•	It has a TaskTracker extension to prevent memory leaks.
•	It can work highly compatibly with Task/ValueTask/IValueTaskSource.

Please check it out:

https://github.com/Cysharp/UniTask

Reply by Email

Related

8. Synchronous and Asynchronous Concepts
·2 mins· loading · loading
Synchronous Programming Most of the programs we write execute the code from top to bottom in the order it was written. Everything is done sequentially. For example, this code illustrates this:
7. What Are Zenject and VContainer Not?
·3 mins· loading · loading
All of the systems mentioned above are frameworks. While I’ve provided examples specific to Unity, we could also include native C# frameworks like AutoFac, but these are systems adapted and optimized specifically for Unity.
6. What is SOLID, and What is It Not?
·1 min· loading · loading
The following five principles, which we have previously explained, form our SOLID principles: Single Responsibility Principle Open/Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle I won’t redefine these terms.
5. Choosing the Appropriate Architecture
·4 mins· loading · loading
After the reminders about optimization in the first three sections, we can bring together the principles from the fourth section to develop an architecture that can be applied to our project.
4. Design Pattern Examples
·10 mins· loading · loading
We can categorize Design Patterns under 3 main headings: Architectural Patterns Examples: MVC (Model-View-Controller), SOLID, MVVM… Design Patterns It is a specific Architectural Pattern, such as Singleton. Using it alone in a project is not sufficient, and optimization with several different patterns is necessary.
3. Why should we use architecture?
·3 mins· loading · loading
One of the fundamental advantages of working with principles and architectures in our projects is that it allows us to benefit from the advantages of libraries and plugins developed specifically for those principles.