playMaker

Author Topic: creating a POOL system (Get FSM game Object returning nothing)  (Read 157 times)

Stain Corb

  • Playmaker Newbie
  • *
  • Posts: 45
    • View Profile
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

Stain Corb

  • Playmaker Newbie
  • *
  • Posts: 45
    • View Profile
Re: creating a POOL system (Get FSM game Object returning nothing)
« Reply #1 on: April 01, 2020, 07:01:29 AM »
Any one ?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4968
    • View Profile
    • jinxtergames
Re: creating a POOL system (Get FSM game Object returning nothing)
« Reply #2 on: April 01, 2020, 12: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.

Stain Corb

  • Playmaker Newbie
  • *
  • Posts: 45
    • View Profile
Re: creating a POOL system (Get FSM game Object returning nothing)
« Reply #3 on: April 01, 2020, 05:12:44 PM »
Thanks a lot, I will try that.  :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4968
    • View Profile
    • jinxtergames
Re: creating a POOL system (Get FSM game Object returning nothing)
« Reply #4 on: April 01, 2020, 10:42:18 PM »
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.