OPTIMIZE and IMPROVE your game with OBJECT POOLING (Unity Tutorial)

Поділитися
Вставка
  • Опубліковано 20 жов 2024

КОМЕНТАРІ • 47

  • @BMoDev
    @BMoDev  4 роки тому +19

    Reduce, reuse & recycle is actually referring to game objects

  • @Tutterzoid
    @Tutterzoid Рік тому +3

    01:27 .. Thanks for explaining object pooling so shortly ..

  • @jakeduncan2721
    @jakeduncan2721 4 роки тому +7

    Well done man, entertaining and educational!

    • @BMoDev
      @BMoDev  4 роки тому

      Thanks, glad you enjoyed! Hope it was helpful!

  • @VitorzMr
    @VitorzMr 4 роки тому +9

    Amazing tutorial my dude. Very straight to the point and entertaining. I didnt like brackey's video on to topic so i stumbled on your video and godbless i did.
    You got another subscriber.
    Congratulations and keep up the work my man.

    • @BMoDev
      @BMoDev  4 роки тому +1

      Thanks man, really appreciate the kind words!

  • @Ghoggles
    @Ghoggles 3 роки тому

    BRUHHHHHH, THANNK YOU!
    I never subscribe to anyone, but here we are. Thanks for actually making things clear. :D

  • @AzaiKang
    @AzaiKang 3 роки тому +3

    Please zoom in the text next time because even though I set the video to 720p, its still unreadable, and playing 720p with slow internet is not worth paying the bill.

  • @Skyblade22
    @Skyblade22 3 роки тому +2

    Your tutorials are so good

  • @GloomyFinn
    @GloomyFinn 4 роки тому +2

    Great tutorial. Thanks a lot. Liked and subscribed!

    • @BMoDev
      @BMoDev  4 роки тому

      Awesome, thank you!

  • @brokenbackisbad9049
    @brokenbackisbad9049 3 роки тому +2

    Love the intro

  • @MsPopelmann
    @MsPopelmann Рік тому

    Nice Video! When I press the mouse button all 20 PooledObject spawn at once, so I see only one projectile. How did you implement your delay?

  • @trieuduong7663
    @trieuduong7663 2 роки тому +1

    Hi, how to delete the amount of will grow back to pooled amount after a few second

    • @ytubeanon
      @ytubeanon 2 роки тому

      that's what's so clever about this script, the 'will grow' shows you how many objects you'll need for pooling

  • @misal-isahabe5281
    @misal-isahabe5281 3 роки тому

    Was good tutorial, thanks.

  • @dcry1003
    @dcry1003 2 роки тому

    Question! is there anyway i can do this but using the trigger function to enable a gameobject or a particle instead of mouse or keyboard inputs?

  • @brycejohansen7114
    @brycejohansen7114 2 роки тому

    Won't the singleton pattern cause problems if you want multiple object poolers with different game objects?

  • @phambaoha170
    @phambaoha170 2 роки тому

    very interesting

  • @Lokithh
    @Lokithh 4 роки тому +4

    what if you have different types of projectiles?

    • @BMoDev
      @BMoDev  4 роки тому

      Good question, theres a lot of solutions to this. The cop out answer is to make multiple ObjectPoolers, but the correct answer is to design a more complex system that can dynamically handle what the pooledObject... Maybe using a ScriptableObject system where you spawn X GameObjects in the Hierarchy, then using scriptable objects during runtime can plugin whatever you want these objects to be.

  • @dominik9351
    @dominik9351 4 роки тому +1

    Awsome Video. Is it possible to use multiple Fire Points?

    • @BMoDev
      @BMoDev  4 роки тому

      Yes totally! Just use the same method of enabling bullets from the pool wherever you want to fire them.

  • @lesleychingwena2611
    @lesleychingwena2611 3 роки тому

    I'm getting a ANR error when I try to set the projectile position to the fire=point position.

  • @bayunity6629
    @bayunity6629 4 роки тому

    if i press the mouse button my bullets not going. Spawn and deactiveted 1 second. Where is the problem

  • @arnoldthegreat4138
    @arnoldthegreat4138 3 роки тому

    hi do u have a link on the projectile controller and player controller script.?

  • @Mr.Yolo.Greedy
    @Mr.Yolo.Greedy 2 роки тому

    ty

  • @ankitmehrotra6104
    @ankitmehrotra6104 3 роки тому

    Awesome

  • @ibrahemrafee2397
    @ibrahemrafee2397 4 роки тому +1

    Big Like but how can you control the Fire rate ??

    • @BMoDev
      @BMoDev  4 роки тому +2

      Thats a larger discussion than a youtube comment, but conceptually you'll need to add a delay whether it be through timers or coroutines in between each shot.

    • @ibrahemrafee2397
      @ibrahemrafee2397 4 роки тому

      @@BMoDev ok thanks a lot

    • @dominik9351
      @dominik9351 4 роки тому +1

      For anyone else looking for a solution:
      public float attackTimer = 0.1f;
      private float currentAttackTimer;
      private bool canAttack;
      void Update()
      {
      attackTimer += Time.deltaTime;
      if(attackTimer > currentAttackTimer){
      canAttack = true;
      }
      if(canAttack){
      canAttack = false;
      attackTimer = 0f;
      Attack();
      //play the sound FX
      }
      }

  • @Yondaime_Ho
    @Yondaime_Ho 3 роки тому

    güzel video

  • @yavuzselimcagan5233
    @yavuzselimcagan5233 2 роки тому

    Noice

  • @inkofthedragon
    @inkofthedragon 2 роки тому

    Is this still efficient in 2022?

    • @BMoDev
      @BMoDev  2 роки тому +1

      Yes

    • @inkofthedragon
      @inkofthedragon 2 роки тому

      Any added benefit in using built in API in version 2021?

  • @mikel2fine
    @mikel2fine 4 роки тому +1

    this dosent work for me and its so frustrating.
    my error: NullReferenceException: Object reference not set to an instance of an object

    • @jojistudios6819
      @jojistudios6819 4 роки тому

      You likely forgot to assign a bullet prefab in the inspector.

    • @ignylz
      @ignylz 4 роки тому +1

      change private list to public list ... public List pooledObjects;

    • @emersonvitor7833
      @emersonvitor7833 3 роки тому

      thanks bro, I had this problem

  • @yinkoveliz3965
    @yinkoveliz3965 4 роки тому +1

    please, zoom on the screen :(((

    • @BMoDev
      @BMoDev  4 роки тому +1

      Sorry! I think my first 4 videos I didn't realize :(
      All of my more recent tutorials I make it a point to zoom in/out on what I'm doing.

  • @TheKhasyk
    @TheKhasyk 3 роки тому

    Copy-Paste from Unity Learn