ObjectPool.cs

35 views
Skip to first unread message

Hunter Luisi

unread,
Feb 26, 2014, 2:51:26 PM2/26/14
to hydrogen-...@googlegroups.com
I've been having a issue where sometimes the object pool singleton will spawn a new game object on application quit (in the editor).  I solved this by checking for null on the Despawn methods.  For example:

public void Despawn (Transform transform, int poolID)
{
   
if (transform != null)
       
ObjectPolls [poolID.Despawn (transform.gameObject);
}

Hope this helps.

H

Matthew Davey

unread,
Feb 26, 2014, 3:13:04 PM2/26/14
to hydrogen-...@googlegroups.com
Hmm that does sound like an interesting problem :)  I haven't seen it myself but this is a good idea none the less :D
I'll add some checks for null to all of them in an upcoming release.

---
Matthew Davey


--
You received this message because you are subscribed to the Google Groups "Hydrogen" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hydrogen-framew...@googlegroups.com.
To post to this group, send email to hydrogen-...@googlegroups.com.
Visit this group at http://groups.google.com/group/hydrogen-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/hydrogen-framework/db6d5c01-d444-4f43-9521-ecbc394cd890%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hunter Luisi

unread,
Feb 26, 2014, 3:21:31 PM2/26/14
to hydrogen-...@googlegroups.com
I think my issue happens because I'm using NGUI and it runs some elements in the editor.  


On Wednesday, February 26, 2014 12:13:04 PM UTC-8, Reapazor wrote:
Hmm that does sound like an interesting problem :)  I haven't seen it myself but this is a good idea none the less :D
I'll add some checks for null to all of them in an upcoming release.

---
Matthew Davey


On Wed, Feb 26, 2014 at 2:51 PM, Hunter Luisi <hlu...@gmail.com> wrote:
I've been having a issue where sometimes the object pool singleton will spawn a new game object on application quit (in the editor).  I solved this by checking for null on the Despawn methods.  For example:

public void Despawn (Transform transform, int poolID)
{
   
if (transform != null)
       
ObjectPolls [poolID.Despawn (transform.gameObject);
}

Hope this helps.

H

--
You received this message because you are subscribed to the Google Groups "Hydrogen" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hydrogen-framework+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages