Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Stain Corb on March 30, 2020, 05:23:10 PM

Title: creating a POOL system (Get FSM game Object returning nothing)
Post by: Stain Corb on March 30, 2020, 05:23:10 PM
Hello all. so I have created a plant growing system but I was using Create/Destroy actions but as you all know this is not very useful, specially when spawning hundreds of hundreds of assets.

So I decided to try to create a POOL system from scratch, and I cloned 10 plants in side of an empty game object where I will be adding all my Disabled assets. I am currently using "Get next child" to be able to get each one in order then be able to activate them and position them, etc...
But I am trying to get the Child using "Get FSM game Object" but it is disabling this action in play mode.

Image attachment showing the error.

These are my plants, the game reaches 5 FPS at 600 plants aprox
Title: Re: creating a POOL system (Get FSM game Object returning nothing)
Post by: Stain Corb on April 01, 2020, 10:01:29 AM
Any one ?
Title: Re: creating a POOL system (Get FSM game Object returning nothing)
Post by: djaydino on April 01, 2020, 03:38:50 PM
Hi.
It looks like you are directing a prefab object to a scene object.

If so that will not work, its a unity limitation.

What you can do is (if you only need 1 object to connect to) use a global variable.
and @ start place the scene object in that global.
Title: Re: creating a POOL system (Get FSM game Object returning nothing)
Post by: Stain Corb on April 01, 2020, 08:12:44 PM
Thanks a lot, I will try that.  :)
Title: Re: creating a POOL system (Get FSM game Object returning nothing)
Post by: djaydino on April 02, 2020, 01:42:18 AM
Hi.
Btw if you have 600 plants active you will probably still have lag tho.

But pooling is definitely good to do if you need to create/destroy a lot.

You also might want to use Array Maker and place your pool object into arrays.
You also can use the default array but array maker is more advanced and easy to reference.