c# - How to use two objects from a pooled list in one script? -


i trying understand object pooling. able script pull 1 object @ time, need able pull 3 or more list @ same time.

my object pooling script big, don't want share whole thing unless necessary.

i need able change location of spawn of flame, created script that:

 private void createwavesforflames(gameobject flame, float xbase, float xdisplacement, float dropheight)  {     flame.transform.position = new vector3(xbase + xdisplacement, dropheight, 0);     flame.setactive(true); //this turn pooled object on }  

so need spawn 3 flames @ same time , change spawn locations

the wave call this:

void wave1() {     debug.log("wave1");     tempgoholder = gm.getlargefire();       createwavesforflames(tempgoholder, 0, 0, 12);     createwavesforflames(tempgoholder, 10, 0, 12);     createwavesforflames(tempgoholder, 15, 0, 12);  } 

what happens 1 fire flame created , uses last creatwavesforflames. need 3 different.

any suggestions on how awesome.

well.. expected code. if want 3 different flame objects, going have this(assuming "gm" pool manager object):

tempgoholder = gm.getlargefire(); createwavesforflames(tempgoholder, 0, 0, 12);  tempgoholder = gm.getlargefire(); createwavesforflames(tempgoholder, 10, 0, 12);  tempgoholder = gm.getlargefire(); createwavesforflames(tempgoholder, 15, 0, 12); 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -