playMaker

Author Topic: [SOLVED] Deleting Objects - Object Spawning & Pooling  (Read 2123 times)

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
[SOLVED] Deleting Objects - Object Spawning & Pooling
« on: September 28, 2018, 12:52:45 AM »
Hi !

See screenshots. I will spawn 10 grounds like this and 20 red bricks will be spawn in different gaps.

Game win when player jumped all over bricks.

Should I write a FSM to delete the ground object after player passed few distance. or shall I leave it? Will leaving it will cause device lag?

Thanks
« Last Edit: September 30, 2018, 12:05:22 AM by heavygunner »

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
Re: Deleting Objects
« Reply #1 on: September 28, 2018, 01:13:25 AM »
Only creating and destroying will cause stuttering, so either use pooling to recycle bricks (which i recommend) or leave them be if they are standing there doing nothing.

Since the bricks are just empty objects with no variables to reset, pool all the way.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Deleting Objects
« Reply #2 on: September 28, 2018, 04:05:04 AM »
Hi.
Indeed pooling is a good option and / or you can reuse the brick to place in front
(offscreen)

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: Deleting Objects
« Reply #3 on: September 29, 2018, 02:26:41 PM »
Thank you for the inputs.
I used "Pooler" from Ecosystem browser and did this.

After created pool, I put 5 sec wait time to see the function. Please check this short video and let know whether I did right or not.

Screen record (59 Secs) :
Thanks  8)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: [SOLVED] Deleting Objects - Object Spawning & Pooling
« Reply #4 on: October 01, 2018, 02:07:10 AM »
Hi.

Looks good.
Now you need to make a setup to despawn then block when it is off screen behind the player.

There are a few ways to do this,
One for example is :
Have a trigger offscreen behind the player and when a 'ground' object hits the trigger despawn it :)