playMaker

Author Topic: PoolManager5 Despawning Enemy  (Read 1157 times)

milanepps

  • Playmaker Newbie
  • *
  • Posts: 2
PoolManager5 Despawning Enemy
« on: June 16, 2016, 12:54:52 AM »
Hey there,

I'm still trying to get the hang of PlayMaker for my 2D games, but I could use a little help. I'm trying to use PoolManager 5 to pool objects (especially enemies and projectiles), but I could use a quick tip on the best way to check for a specific despawn point. I already have the enemy spawning from the spawn pool with no problems. But I want to have the enemy despawn once it reaches the end of its preset waypoint path. The code I had in my script was:

 if(currentPoint >= path.Length)
          {
      Destroy(this.gameObject);
          }

which I changed to:
 
 if(currentPoint >= path.Length)
          {
      PoolManager.Pools["Enemies"].Despawn(Beetle1);
          }

But because my enemyprefab is a GameObject, I had to them create another reference as a Transform in order for Unity to know which object I'm talking about, and even then, I get errors about the enemyPrefab not being found in the SpawnPool anymore. Is there another way I can just delete this part of my code and use PlayMaker to check for when the enemy reaches the end of its path and to send the message to despawn?

I tried to contact the publisher for PoolManager through their forums and they haven't gotten back to me yet, even after 3 days of waiting. Any help is much appreciated.
Thanks a bunch,
Milan
If I don't ask, how will I learn?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PoolManager5 Despawning Enemy
« Reply #1 on: June 23, 2016, 01:36:13 AM »
Hi,

 Ok, 3 days isn't a lot, and you should simply "bump" your question on the forum to get attention. Publishers are very busy, so sometimes it takes days to get a reply, don't think they try to ignore you, it's difficult to keep up.

Yes, Pool Manager is supported for PlayMaker via our community, on the wiki:

https://hutonggames.fogbugz.com/default.asp?W839

So you'll have all the actions you need to spawn, and despawn from pools. But you question seems to be more about waypoints. So it depends what waypoint system you are are using, but in all cases, that system will have a way to tell you that a gameobject reached a waypoint. If these waypoint are custom and you built them, then you'll need to use "triggers" quite simply. Once your ennemy enters a waypoint trigger, you despawn it.

As for your errors, it seems a problem with the way you setup pool and use them, it seems you have really yet grasp how pools work, so I would read the doc and inspire from existing samples before getting back to this, it's very important.

You can delete that part of a code and switch to PlayMaker, but you need to make sure that your waypoint system has PlayMaker support somehow. I know this one has for example: https://www.assetstore.unity3d.com/en/#!/content/2506 but there are many mores for sure.

 Bye,

 Jean