Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: heavygunner on September 28, 2018, 12:52:45 AM

Title: [SOLVED] Deleting Objects - Object Spawning & Pooling
Post by: heavygunner 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
Title: Re: Deleting Objects
Post by: Fat Pug Studio 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.
Title: Re: Deleting Objects
Post by: djaydino 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)
Title: Re: Deleting Objects
Post by: heavygunner 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)
Title: Re: [SOLVED] Deleting Objects - Object Spawning & Pooling
Post by: djaydino 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 :)