Search Unity

Access enemy list id from object pool

Discussion in 'Scripting' started by henmachuca, Feb 12, 2018.

  1. henmachuca

    henmachuca

    Joined:
    Oct 14, 2016
    Posts:
    105
    Hi, I have a spawn object in my scene which spawns enemies when the player is nearby, and it uses object pooling, so it makes the gameobject active when the player comes near.

    Lets say I spawn more then 1 enemies...

    How can I know which id from the list I killed so I can set it to active false?


    Thank you.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'd have a script on the enemy that sets itself to inactive when it dies.