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 🙂
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!
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.
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!
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!
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);
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!
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.
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?
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. 😢
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 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
@@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
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!
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 🙂
Thanks so much, I really appreciate that!😊
Thank you! I've been looking for a complete description with examples and this is perfect.
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!
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.
Thanks for the feedback, glad you liked it!
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!
This should come in handy for spawning particles, as you mentioned!
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!
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);
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!
Glad you enjoyed it!
Great tutorial, thanks!!
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.
Quality Tutorial
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?
I've got a problem, I instatiate the objects once but they are not ever picked back, how should I fix it?
So this doesn't discus what to do when the bullet can be spawned on any gun and the rotations are always off?
Thanks very much!
Many thanks ❤
Thx. Can you elabkrate more on how to addapt it into netcode system?.. Thx so much
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. 😢
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 =(
Thanks!
Thanks for the support!
how do you make your sprites glow in 2d? im trying different methods but nothing seems to work
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!
Buy that makes all the sprites in the scene glow, how do you manage to glow only the bullets?
@@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
@@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
Interesting!
Have you made any games to completion before? Any game? Mobile, PC or whatever? Even a tiny game?
I'd say over half a dozen at this point
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
game jams are the best!
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!
I am excited cause why are you typing so fast. Are you speeding up xD?
Here's a video explaining in more detail why I wrote my own:
czcams.com/video/TswH7TYTLhQ/video.html
First
🍝 spaghetti