How to Setup An Object Pool (New Built In Method) | Unity Tutorial

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • Hry

Komentáře • 41

  • @pocket-logic1154
    @pocket-logic1154 Před rokem +11

    Showing your mistakes is admirable. Object pooling might not be something I ever use in my game, but this is a very elegant solution. Awesome video. Your research into how to create engaging YT videos has really paid off. When you hit a million subs, I can say I was here at the beginning of that journey 🙂

  • @snacksonaplane
    @snacksonaplane Před rokem

    Thank you! I've been looking for a complete description with examples and this is perfect.

  • @MaximumSpice
    @MaximumSpice Před rokem

    Figured I'd give you another comment to help with the YT algo ;) Finally had time to sit down and type it out, fantastic setup, works super nicely and easily. Really nice way of doing it too now that I've gone through it, way nicer method then the old style with interfaces and it just sets up like a function. Love it! Thanks for the video man!

  • @Betruet
    @Betruet Před rokem +2

    I first learned to pool using a list so that's what I stick to in my projects but this was a great video! I'm sure it will be super useful to many.
    I like the way you fix issues on the fly, it's really good showing errors and mistakes is great for people to troubleshoot their own issues. Some tutorials actually steer people astray because they gloss over the little errors that arise from changing scripts or they intentionally remove all the errors that may arise beforehand by simplifying the tutorial. As we all know thats not the way it works sure simple is good but as soon as the beginner hits an error they are lost.

  • @MaximumSpice
    @MaximumSpice Před rokem

    Really great video and really well explained, most other people go through but not with a simple but real example people would use. Thanks man, will implement this tonight!

  • @tabuuforte8546
    @tabuuforte8546 Před 9 měsíci

    This should come in handy for spawning particles, as you mentioned!

  • @rcdemoral1982
    @rcdemoral1982 Před 6 měsíci

    Yup, this is the best Object Pooling tutorial I've seen so far. Very clear, everything explained, no lambda functions that beginners don't know... Thanks!

  • @andrewgorax
    @andrewgorax Před rokem +1

    Hey Brandon, awesome tutorial! Very explanatory and easy to follow. I'm becoming a fan of your channel.
    One thing I would improve here though is the DeactivateBulletAfterTime coroutine. Unless we actually do something more than just increase the time in our while loop, we can replace the loop with a simple one liner: yield return new WaitForSeconds(3f);

  • @TheArghnono
    @TheArghnono Před rokem

    Excellent tutorial. I appreciate you striving for clean code; we all mess up but future us will thank us for getting boring stuff like naming conventions right. It is also useful that you show your process!

  • @ThanhNguyen-po7zy
    @ThanhNguyen-po7zy Před 5 měsíci

    Great tutorial, thanks!!

  • @lanham192
    @lanham192 Před 2 měsíci +1

    Private variables don't need to start with an underscore. It isn't "proper naming convention". It's a relic. Do it if you want but don't call it "proper" as it's redundant.

  • @user-kn6hw1hb5e
    @user-kn6hw1hb5e Před 8 měsíci

    Quality Tutorial

  • @christopherrapczynski204

    so this video has the pool be a per gun basis, where each time there is a new gun it would have to create its own local pool and instantiate its own objects. would it be better to create a world pool for that bullet type and have all guns pull from that? or would that be too much to manage and would end up costing more performance than its worth?

  • @Tobi_A
    @Tobi_A Před rokem

    I've got a problem, I instatiate the objects once but they are not ever picked back, how should I fix it?

  • @ChadGatling
    @ChadGatling Před 11 měsíci

    So this doesn't discus what to do when the bullet can be spawned on any gun and the rotations are always off?

  • @andytyler2237
    @andytyler2237 Před rokem

    Thanks very much!

  • @donmacsween2842
    @donmacsween2842 Před 7 měsíci

    Many thanks ❤

  • @NLPIsrael
    @NLPIsrael Před rokem

    Thx. Can you elabkrate more on how to addapt it into netcode system?.. Thx so much

  • @TheOriginalDuckley
    @TheOriginalDuckley Před rokem

    I hate the GUI repaint taking up to much garbage collection. Is it just standard that it takes up 368B? Cause mine takes up exactly that much in my profiler too and I spent a few hours trying to figure out how to reduce it but no dice. 😢

  • @Madix1024
    @Madix1024 Před 5 dny

    Is this on a github somewhere? I'd love to just be able to look at the scripts to see what's going on because I'm clearly going wrong somewhere =(

  • @alphagabe
    @alphagabe Před 8 měsíci

    Thanks!

  • @ovan367
    @ovan367 Před rokem +1

    how do you make your sprites glow in 2d? im trying different methods but nothing seems to work

    • @sasquatchbgames
      @sasquatchbgames  Před rokem

      You need to use the bloom post-processing effect. A common troubleshooting issue is people forget to tick "post-processing" on their camera.
      You'll also need to ensure you are using a shader that has an HDR color on it (if you don't have high dynamic range, bloom won't take effect) - there should be some by default depending on whether you are using URP or built-in render pipelines.
      If you can't find one- you can create your own real fast by creating a new sprite lit or unlit shadergraph.
      - Create 2 Properties - a Texture2D and a Color
      - Name the Texture2D "MainTex"
      - set the Color Mode to HDR
      - Connect your Texture2D to a SampleTexture2D node.
      - Drag the RGBA output from the SampleTexture2D node into a multiply node in A
      - Drag your Color property and connect it to that multiply node.
      - Drag the output from that multiply node into the "Base Color" under the "fragment" section
      - Drag the "alpha" from the Sample Texture2D and connect it to the "Alpha" of the fragement section.
      Apply a material that uses that shader onto your sprite. And if your post-processing is setup correctly, it'll glow.
      Good luck!

    • @ovan367
      @ovan367 Před rokem

      Buy that makes all the sprites in the scene glow, how do you manage to glow only the bullets?

    • @sasquatchbgames
      @sasquatchbgames  Před rokem +1

      @@ovan367 if all your sprites are glowing then either you have your threshold cranked up too high in your post-processing settings, or you applied the HDR shader to everything instead of just the bullets.
      Play with the post-processing numbers. You likely want a threshold that's over 1 so normal sprites don't have a glow as well

    • @ovan367
      @ovan367 Před rokem

      @@sasquatchbgames i have all the sprites with the URP Sprite-Lit-Default shader, and my threshold is pretty low. I don't know what should I have done, but it's not working properly. Thank you anyway

  • @apollodavis4090
    @apollodavis4090 Před rokem

    Interesting!

  • @sicga4925
    @sicga4925 Před rokem

    Have you made any games to completion before? Any game? Mobile, PC or whatever? Even a tiny game?

  • @samidev4122
    @samidev4122 Před rokem

    Hello sir, can you give me some tips for game development, actually I am stuck to tutorial from last 2 years, not able to make a single game

    • @KyleDelazy
      @KyleDelazy Před rokem

      game jams are the best!

    • @sasquatchbgames
      @sasquatchbgames  Před rokem +6

      Depends on what stage you're in. Sounds like you're a beginner, which is when it's the hardest.
      My advice:
      - Follow 3-5 handholding tutorials where you do everything they do on the screen. You won't learn much about code that way, but you'll learn about the engine and get comfortable with the workflow of how things operate.
      - Next, attempt to make a tiny game like flappy bird or or pong or asteroid.
      - You'll do that by breaking the core concept of the game down into tiny steps. example: How do i get the bird to show up on the screen. How do i get it to fall? How do i get it to jump up when i click the mouse? Etc. Etc. Each and everyone of those things can be achieved using Google and/or ChatGPT to help.
      - Do a few of those, and before you know it...you'll understand some basic code concepts.
      - rinse repeat. Continue pushing the boundaries of what you know so everytime you work on a project you learn something new.
      Good luck!

  • @Domharlequin
    @Domharlequin Před rokem

    I am excited cause why are you typing so fast. Are you speeding up xD?

  • @midniteoilsoftware
    @midniteoilsoftware Před rokem

    Here's a video explaining in more detail why I wrote my own:
    czcams.com/video/TswH7TYTLhQ/video.html

  • @Coco-gg5vp
    @Coco-gg5vp Před rokem

    First

  • @dharmeshkumar2763
    @dharmeshkumar2763 Před 10 měsíci

    🍝 spaghetti