Tarodev
Tarodev
  • 98
  • 6 465 812
Unity async / await: Awaitable
In this follow-up video, we explore the Awaitable class introduced in Unity 2023.1, which aims to improve asynchronous programming workflows.
See part 1: ua-cam.com/video/WY-mk-ZGAq8/v-deo.html
Topics Covered:
1. Learn about the new Awaitable.WaitForSecondsAsync, NextFrameAsync, EndOfFrameAsync & FixedUpdateAsync.
2. Learn about cancellation tokens and simplified workflows with MonoBehaviour's new built-in destroy token.
3. Efficiently switch between main and background threads using Awaitable.MainThreadAsync and Awaitable.BackgroundThreadAsync methods.
4. Manage your long-running tasks with WhenAll
5. WebGL support
6. Backward compatibility for AsyncOperations.
Like the video if it's helpful, and feel free to subscribe for more straightforward Unity tutorials and tech demos.
For questions or comments, please leave them below.
❤️ Become a Tarobro on Patreon: www.patreon.com/tarodev
=========
🔔 SUBSCRIBE: bit.ly/3eqG1Z6
🗨️ DISCORD: discord.gg/tarodev
✅ MORE TUTORIALS: ua-cam.com/users/tarodev
0:00 Intro
0:27 Introducing Awaitable
2:07 Cancellation tokens / destroyCancellationToken
5:20 BackgroundThreadAsync / MainThreadAsync
6:55 Returning Awaitable
7:55 WebGL compatibility
8:34 Legacy support
#Unity #Unity2023 #AsyncAwait #GameDevelopment #Programming #Awaitable #CancellationTokens #ThreadSwapping #webgl
Переглядів: 36 668

Відео

UI Toolkit Primer - Build UIs like a Programmer
Переглядів 48 тис.10 місяців тому
Building interfaces is now effortlessly simple with the powerful new UI Toolkit. I'll guide you through how I, as a programmer, construct these interfaces and walk you through the essential fundamentals of the UI Toolkit. Dive deep into topics including styling with USS, animations, transitions, decoupled UI, and much more. Girl scene project files: www.patreon.com/tarodev Source code: github.c...
Don't make grids without knowing THIS in Unity
Переглядів 105 тис.11 місяців тому
Utilizing this component dramatically simplifies the task of designing a grid. By defining the parameters such as tile size, gap, and type within the Grid Component, it automatically computes world positions based on the specified grid indices. This reduces the complexity of placement, ensuring an efficient and streamlined grid creation process. Thanks GPT, lol :) Source: gist.github.com/Matthe...
How To Render 2 Million Objects At 120 FPS
Переглядів 137 тис.Рік тому
Project files: github.com/Matthew-J-Spencer/pushing-unity Let's discover the true potential of Unity by pushing its limits. In this video, we'll explore a variety of techniques, from straightforward tweaks like data-oriented design, to more advanced methods such as direct GPU rendering and compute shaders. Join us as we uncover the power and flexibility that Unity has to offer! Some techniques ...
Cloud Save should be in EVERY game (full project source code)
Переглядів 48 тис.Рік тому
Checkout cloud save: on.unity.com/3yyb3He Project: github.com/Matthew-J-Spencer/Cloud-Save Wrapper: bit.ly/3FsNXWz Utilizing Cloud Save in your game enables effortless synchronization of player data to the cloud, eliminating the need for intricate backend configurations. This service is free of charge until your player base reaches a substantially large number. Incorporating Cloud Save in your ...
10 Things You NEED to Be Doing in Unity
Переглядів 127 тис.Рік тому
A collection of vital tips and techniques I use in Unity every day. Some are Unity specific, while some are just good programming practices. Let me know if I taught you anything! ❤️ Become a Tarobro on Patreon: www.patreon.com/tarodev 🔔 SUBSCRIBE: bit.ly/3eqG1Z6 🗨️ DISCORD: discord.gg/tarodev ✅ MORE TUTORIALS: ua-cam.com/users/tarodev 0:00 Intro 0:08 Serializing components 1:18 Drawing scene gi...
Unity Collision Cheat-Sheet - Discrete vs Continuous
Переглядів 38 тис.Рік тому
Each collision mode offers a unique collision mechanic. Knowing which one to use is key for solid gameplay and performance. Discrete is the most performant option and should be used whenever possible. Calculations collisions each fixed step. Continuous uses a sweeping algorithm to guarantee collisions from a linear motion, but is quite a bit more expensive than discrete and only hits static col...
How to setup Global Matchmaking for Unity
Переглядів 71 тис.Рік тому
Global matchmaking has never been easier with Unity's new Lobby and Relay systems. With just a few lines of code you can match players from around the world to play together. Bypass network hassles using relay and create customized games using lobby. Lobby & Relay: on.unity.com/3HMloU8 Netcode git url: com.unity.netcode.gameobjects Project files (this is a complete solution): github.com/Matthew...
Animate like a Programmer
Переглядів 218 тис.Рік тому
As a programmer, using the Unity animator can feel like you're losing some control over your game. We can manage our animation transitions entirely from code... Animation will feel as natural as your player controller script. Code: bit.ly/3P4DdA2 I'll be expanding this code on my ultimate 2D controller, which can be found here: www.patreon.com/tarodev Animancer: assetstore.unity.com/packages/to...
How to: Unity Online Multiplayer
Переглядів 219 тис.2 роки тому
Netcode for Unity is an amazing real-time multiplayer solution, which is part of the wider Unity Gaming Services. Checkout Netcode: on.unity.com/3blzOy3 In this video you'll learn: How to get started with Netcode The different between server & client authority and when to use each How to write performant network code How to use NetworkVariable & INetworkSerializable Cheap multiplayer interpolat...
Sine Waves Visualized
Переглядів 73 тис.2 роки тому
Learn how to use sin and cos waves. I use unity here but, but the math is agnostic Sine and Cosine are fundamental to game development. Once you understand how Mathf.Sin and Mathf.Cos work, you'll find yourself reaching for them all the time. You can create circles and waves, make things hover, create orbits, add enemy behavior, etc. REUPLOADED: My original voiceover was horrible quality and qu...
Value & Reference types in C#. Write Better Code!
Переглядів 33 тис.2 роки тому
Value vs reference types. Stack vs heap. These are fundamental concepts to understand if you wish to write performant code. Learn the characteristics of value and reference types and how they're allocated to memory. Learn how StackOverflowException occurs and how to fix and prevent them. ❤️ Become a Tarobro on Patreon: www.patreon.com/tarodev 🔔 SUBSCRIBE: bit.ly/3eqG1Z6 🗨️ DISCORD: discord.gg/t...
Project Initialization - Unity Architecture
Переглядів 36 тис.2 роки тому
Preload scenes are the past man. Initialize your required assets easily using the RuntimeInitializeOnLoadMethod attribute. Prevent race conditions and dependency hell with this neat trick. Code: bit.ly/3kQzVmJ Happy architecture, happy life. ❤️ Become a Tarobro on Patreon: www.patreon.com/tarodev 🔔 SUBSCRIBE: bit.ly/3eqG1Z6 🗨️ DISCORD: discord.gg/tarodev ✅ MORE TUTORIALS: ua-cam.com/users/tarodev
Local Functions in C# - Stay Inside Me
Переглядів 23 тис.2 роки тому
Learn about local functions and how you can use them for cleaner, more performant code. Local functions were released in C# 7. ❤️ Become a Tarobro on Patreon: www.patreon.com/tarodev 🔔 SUBSCRIBE: bit.ly/3eqG1Z6 🗨️ DISCORD: discord.gg/tarodev ✅ MORE TUTORIALS: ua-cam.com/users/tarodev
Creating a hyper casual game in 3 hours
Переглядів 40 тис.2 роки тому
Today I recreated a hyper-casual mobile game I saw my son playing: Gun Sprint. Something called to me when I saw the fun mechanic and I felt compelled to recreate it, in Unity of course. It involved a bit of fun problem solving using a few different Unity techniques, so hopefully you can learn something. If not, just have fun watching :) Script: bit.ly/3uLM3eA Game: tarodev.itch.io/gun-sprint G...
Unity tips to improve your efficiency
Переглядів 42 тис.2 роки тому
Unity tips to improve your efficiency
Create a server for your Unity game using .NET Core (Part 2)
Переглядів 26 тис.2 роки тому
Create a server for your Unity game using .NET Core (Part 2)
Create a server for your Unity game using .NET Core
Переглядів 70 тис.2 роки тому
Create a server for your Unity game using .NET Core
C# Events & Delegates
Переглядів 84 тис.2 роки тому
C# Events & Delegates
Unity Code Optimization - Do you know them all?
Переглядів 184 тис.2 роки тому
Unity Code Optimization - Do you know them all?
Gaming Backend (leaderboard, inventory, guilds and more)
Переглядів 23 тис.2 роки тому
Gaming Backend (leaderboard, inventory, guilds and more)
Timetrial Ghosts in Unity
Переглядів 23 тис.2 роки тому
Timetrial Ghosts in Unity
Auto-save in Unity? About time...
Переглядів 29 тис.2 роки тому
Auto-save in Unity? About time...
Responsive Camera Design in Unity
Переглядів 41 тис.2 роки тому
Responsive Camera Design in Unity
How to make a Homing Missile in Unity with Trajectory Prediction (source included)
Переглядів 57 тис.2 роки тому
How to make a Homing Missile in Unity with Trajectory Prediction (source included)
Unity Script Templates - Changing default script content
Переглядів 30 тис.2 роки тому
Unity Script Templates - Changing default script content
Ultimate 2D Platformer Controller in Unity (source code provided)
Переглядів 305 тис.2 роки тому
Ultimate 2D Platformer Controller in Unity (source code provided)
Object References in Unity - How to Communicate Between Scripts
Переглядів 113 тис.2 роки тому
Object References in Unity - How to Communicate Between Scripts
Sprite Shadows in Unity - Cast and receive shadows using a SpriteRenderer
Переглядів 60 тис.2 роки тому
Sprite Shadows in Unity - Cast and receive shadows using a SpriteRenderer
Unity Architecture for Noobs - Game Structure
Переглядів 188 тис.2 роки тому
Unity Architecture for Noobs - Game Structure

КОМЕНТАРІ

  • @kiryonnakira7566
    @kiryonnakira7566 6 годин тому

    3:57, It's physically impossible to be slower using a squared magnitude than using the magnitude. I'm 100% certain that the disparity in your result is from the randomness being taken into account. One thought about Camera.main, does building the app make a difference in the results ? 11:50 i'm curious as to how much the `ToList()` impact performances. In some scenarios you don't need to create a list out of it, just to iterate over the selected elements. Again, also curious if the LinQ is not optimised once you've done the build. 15:30 Yes, the reasons for float * vector * float being slower is because you need to do 3 multiplication (x, y, and z) while just doing operation with floats first mean you'll do those 3 operations only once. That also means that it doesn't matter if you have just vector * float or float * vector. -------------------------------------------------------------- After testing with the webgl build ---------------------------------------------------------------- I can confirm that the squared magnitude is always faster. Your results were really weird. The camera is faster by manually caching it even on the build. Nah, LinQ is really bad performance wise. Maybe it got improvements by now, who knows, but it sure is damn slow.

  • @dormitando
    @dormitando День тому

    Hey man are you by chance a web dev or have been in the past?

  • @themihanoid5020
    @themihanoid5020 2 дні тому

    Throughout the whole video I had less and less idea of what's going on...

    • @Tarodev
      @Tarodev 2 дні тому

      That's not good

  • @Gurem
    @Gurem 3 дні тому

    I would like a tutorial that wasn't a simplified version please. What is the setup for failure teaching method.

  • @jalanlurus1732
    @jalanlurus1732 3 дні тому

    Please upload the script that made in your videos

  • @itsJDarts
    @itsJDarts 4 дні тому

    No way this guy is reading 700 comments

    • @Tarodev
      @Tarodev 3 дні тому

      How dare you doubt me

  • @WAQASplayzYT1
    @WAQASplayzYT1 4 дні тому

    i was just making leader board ranking and this video comes up thank u man

  • @iso.dev9
    @iso.dev9 4 дні тому

    Ur channel is awesome keep it up :)

  • @villagerjj
    @villagerjj 6 днів тому

    epic tutorial! thanks :)

  • @settiz_games
    @settiz_games 6 днів тому

    var isOffset = (x + y) % 2 != 0;

  • @gabriebvsousa
    @gabriebvsousa 8 днів тому

    Great content. I'm glad I have found you on this sea of content that is UA-cam.

  • @languageengineer8782
    @languageengineer8782 8 днів тому

    This is a super extremely fascinating video for me. I am working on a game where each gameobject has its own script. The sobjects can be a lot. When I have about 5000 objects, unity starts to drop the framerate to about 40. My goal is to publish the game for windows, android and ios devices. In this case which techniques would you recommend? I wish I could use a number of 50k gameobjects, all having their own scripts including movements and rotations and also a collider component. I was trying to do whatever I could but i only got small improvements. Now I saw this video and I am just speechless, that this is even possible. The gameobjects that I have all have their own colliders and when they touch another gameobject, both gameojects will be destroyed and again instantiated. I already know that this could be improved to pooling, but the problem is not the destroy and instantiating, the problem of my low framerate is because I have too many gameobjects that are all having and running their own scripts. Would be super thankful if you had an advice for me.

  • @feb22tebek
    @feb22tebek 9 днів тому

    Loved the vid!

  • @pawegorka8589
    @pawegorka8589 9 днів тому

    It seems like you assume that everybody already knew what you know 😅 and it's not always the case For me it's all super fun and new

    • @Tarodev
      @Tarodev 9 днів тому

      Should every tutorial start by showing you how to install unity and create a new project? You can't expect everything to be catered perfectly to your skill level

    • @pawegorka8589
      @pawegorka8589 9 днів тому

      @@Tarodevi'm just noobie in this matter and it seems like not a content for me, dont take it personally, it's surely well done tutorial

  • @pawegorka8589
    @pawegorka8589 9 днів тому

    😂 Amateurs I've never had this problem because I never have any structure in my projects 😅

  • @AlatroyX
    @AlatroyX 10 днів тому

    Curious, when using the rating system, why do we include the distance from the starting node in it too? Is it some kind of balancing system to keep the path from A to B closer together or something?

  • @arjunmehta2853
    @arjunmehta2853 10 днів тому

    Hey! In the part where you were talking about masking, when you add the Mask component, there is an option to untick "Show Mask Graphic" in order to remove the white part, which is the better method to use. Hope this helps!

  • @spekticat
    @spekticat 11 днів тому

    Oh he said SLOT

  • @MrScripts.
    @MrScripts. 11 днів тому

    Huge shoutout bro! I am doing a videogame using your script! i will mention you everywhere ofc!

  • @sunkenship9552
    @sunkenship9552 11 днів тому

    So I got this working but I'd like to know why this works at all. The blueprint provided looks very simple so I'm curious what its doing. I'm new to working with shaders and shader graphs so I don't know too much. Can someone also explain what the Vertex Color node does? The doc says it gives access to the Vertex Color value but what does this mean? Is it just a way to access the sprites colors, and if so how does it gain access to the texture because from my understanding you have to specifically give references to textures or use _MainTex to access the main one in the sprite renderer for that game object.

  • @linhdev99
    @linhdev99 11 днів тому

  • @stevenpike7857
    @stevenpike7857 12 днів тому

    WOW! I downloaded the code, loaded it und followed you on this video. Can't believe it was this easy to follow along with you. Excellent set up of the software, easy to understand. :) Awesome video!

    • @Tarodev
      @Tarodev 12 днів тому

      Welcome aboard ❤️

  • @Skybot437
    @Skybot437 13 днів тому

    Dope. Now I can wipe that spiderweb out of my animator. Thanks!

  • @adamkis7137
    @adamkis7137 13 днів тому

    Is that include assemblies too? Components scripts/dll-s with all dependencies? (e.g. non-component stuff like JSON Parser etc)

  • @roobplayer
    @roobplayer 13 днів тому

    Thank you. It is very useful for me. 😃

  • @INFSTUDIO800
    @INFSTUDIO800 14 днів тому

    That Asgore attack on Undertale :

  • @bpdhoplite
    @bpdhoplite 14 днів тому

    Finally someone who uses the listener and doesnt just run a string in the update method ty

  • @_sIash
    @_sIash 14 днів тому

    I always end up finding the solution to almost anything on this channel, bravo taro 👍

  • @matt90673
    @matt90673 15 днів тому

    thank you for the video

  • @chaycock
    @chaycock 15 днів тому

    I rarely comment on videos except to be sarcastic or silly. But your Unity/dev content is incredibly well done, and I hope you keep going. Thanks for all you’ve done so far!

    • @Tarodev
      @Tarodev 14 днів тому

      Thanks for taking the time to say that :) I will be back soon with more videos! (this is what I tell myself)

  • @darkbf8493
    @darkbf8493 15 днів тому

    Hello. This is an amazing video. I really appreciate it. However, the background music i believe is totally unnecessary and distracting. Thanks for all those information you shared with us.

  • @M1RR0R
    @M1RR0R 16 днів тому

    The video really helps thank you. I just have a question. It creates a new lobby and starts as host each time when there is no available lobby, so doesn't that mean there can be multiple hosts at the same time? For example, in a scenario that max player number is five, and 15 players want to play. Will three hosts at the same time be ok?

  • @jirikropocev9911
    @jirikropocev9911 17 днів тому

    Very nice video: clear, informative and easy to understand. Thank you!

  • @user-dc3pk2kp4e
    @user-dc3pk2kp4e 17 днів тому

    Now we can make own Total War)))

  • @007_man
    @007_man 17 днів тому

    Bro yu should make tutorial about this. This controller is fire 🔥🔥

  • @pewpew518
    @pewpew518 17 днів тому

    Join the dark side

  • @vishwasharma7585
    @vishwasharma7585 18 днів тому

    Top-tier multiplayer content.

  • @Director414
    @Director414 18 днів тому

    I would be so happy if you made a video about how to manage projects when they grow. For example, deleting library folder sometimes, but mainly I think senior devs have multiple projects simultaneously and export imported assets from one to the other due to the enormous size of some imported assets from the assets store. How to "clean" imported assets (perhaps from another project) to make them as small as possible for your main project? Questions like these are would be so awesome to get answered from a pro like you! :) Cheers and keep up the good work, your channel is awesome!!

  • @chessersstudios1778
    @chessersstudios1778 19 днів тому

    thank you

  • @imamdarwin3750
    @imamdarwin3750 19 днів тому

    Instead of moving the camera I instantiated my tiles as my gridManager's childs and moved my grid manager to -_height/2 , -_length/2. This way tiles are still starting from the position 0,0 relative to their parents.

  • @Bat3p
    @Bat3p 19 днів тому

    I agree with having a naming convention. Suggesting capitals for public variables is against C# and Unity's coding conventions. Capital variables are reserved for properties.

  • @Wjg1337
    @Wjg1337 19 днів тому

    This tutorial is very incomplete. But someone trying to get their multiplayer working, will get it working. Partially with help from some of this video, and from trial & error.

  • @marc8150
    @marc8150 19 днів тому

    I guess the same applies for Quaternion.Slerp as well, correct?

  • @publicalias8172
    @publicalias8172 20 днів тому

    Thank you for just getting to the point.. my attention span is fried I was reluctant to even watch this, but you drew me in with the up-front examples this was awesome!

    • @Tarodev
      @Tarodev 20 днів тому

      I'm catering to people like myself (and you), who don't want to hear the life story of the dev

  • @celinedrules
    @celinedrules 20 днів тому

    I couldn't tell you how many people use public fields instead of using SerializedField and properties. Almost every single one. As far as naming convention, I do the exact the same thing. It helps with local scoped variables that have the same name as field variables. You then don't have to use this keyword. Instead of this.someVariable = someVariable You can do _someVariable = someVariable

    • @Tarodev
      @Tarodev 20 днів тому

      Exactly 😊

  • @tw1ZTER
    @tw1ZTER 20 днів тому

    i realized i had a bunch of Find and FindObjectOfType<> inside a few updates lol

  • @Cubemil
    @Cubemil 21 день тому

    I had to laugh so much at 'DestoryChildren... that sounds horrible'

  • @abdullahdief1491
    @abdullahdief1491 21 день тому

    In the video you say that you have no rb and no collider, but the source code require both. I don't get. And the code shown doesn't resemble the source code at all. I am confused

    • @Tarodev
      @Tarodev 20 днів тому

      Let me unravel your confusion 😊 Over the years this controller has gone through many mutations. I still maintain the preoum version on patreon. At one stage I converted it over to use the built in systems and really didn't lose anything valuable.

  • @Sodomantis
    @Sodomantis 23 дні тому

    Where is the Tarodev now?

  • @leomac3464
    @leomac3464 23 дні тому

    Thanks. I took a lot out of that.