Search Unity

Fixing the ArgumentOutOfRangeException: Argument is out of range. Parameter name: index

Discussion in 'Scripting' started by Ultimate360, Jul 20, 2017.

  1. Ultimate360

    Ultimate360

    Joined:
    Oct 28, 2016
    Posts:
    27
    Hi, I'm really stock with my code. What have I done wrong? The game runs, I don't know what cause of this error:
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index

    Even though I have made check if this arrayVar[index] is null (or did not exist/out of scope?) then don't register this to tempVar... I'm using List<T>... Is there something to do with foreach, StartCoroutine, List<T>, or array?

    :( Please help me what's wrong with the script, thanks for your time...

    Here's what in my console:

    I have Debug.Log ("Destination B-3: Went here successfully!"); Destination: B-3, B-4, B5 did not display in the same IEnumerator startRespawn. It did not reach there... That means my Instantiate did not happen...

    I also check when that error appeared; it appeared after line 194 that is "if (bulletRush.timeCode >= thisTime.start && thisTime.duration > 0f)". Thank you for your help.

    :confused: Here's my unfinished script: (You may copy and paste this for clarity)
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. [System.Serializable]
    6. public class BulletModification {
    7.     [Header("Modify Cluster:")]
    8.     public float startSpeed;
    9.     public enum generateAcceleration {
    10.         byUnit,
    11.         byPercentage
    12.     } public generateAcceleration accelerationType;
    13.     public float acceleration;
    14.     public float speedRange;
    15. }
    16.  
    17. [System.Serializable]
    18. public class TransformFormula {
    19.     //[Header("Stir Bullet:")]
    20.     [Header("Mirror Bullet:")]
    21.     [Tooltip("0 means all copies will be on sync, beyond that will make delay offset speed; 100 makes the last delay copy to stationary, 200 makes go to opposite direction. Set delayAmount above 0 to see result")]
    22.     [Range(0,200)] public float speedOffset;
    23.     [Tooltip("Number of clone bullets for offset speed. Set speedOffset to work with")]
    24.     [Range(0,3)] public int delayAmount;
    25.     [Tooltip("Number of clone bullets shoot parallel to each other")]
    26.     [Range(1,128)] public int linearAmount = 1;
    27.     public enum spaceType {
    28.         byUnitAway,
    29.         byOverallWidth
    30.     }; [Tooltip("How parallel bullets take up space")] public spaceType areaOccupy;
    31.     [Tooltip("The amount of parallel bullets away each other or their general width as one group")]
    32.     public float spacingValue;
    33.     [Tooltip("Number in seconds; parallel from the middle will start immediately, then delay start to the next neighbor line")]
    34.     [Range(0,20)] public float delayLinear;
    35.  
    36.     [Header("Spray Bullet:")]
    37.     [Tooltip("The degree angle of an arc be made for rayAmount")]
    38.     [Range(0,360)] public float spreadAngle;
    39.     [Tooltip("The number of copy bullet as rays restricted by spreadAngle")]
    40.     [Range(1,32)] public int rayAmount = 1;
    41.     [Tooltip("The radius offset of the center of the ray")]
    42.     public float spawnOffsetRadius;
    43.     [Tooltip("Number in seconds; the first ray will start immediately, then delay start to the next neighbor ray")]
    44.     [Range(0,20)] public float delayRay;
    45. }
    46.  
    47. [System.Serializable]
    48. public class TransformPattern {//bulletMotion
    49.     [Header("Bullet Patterns:")]
    50.     public Vector2 respawnOffset;
    51.     [Tooltip("Sliding the respawn origin of bullet sideward from left to right length-based over given duration")]
    52.     public float linearMagnitude;
    53.     public enum linearMotionType{
    54.         Linear,
    55.         Wave
    56.     }; public linearMotionType linearFlow;
    57.     public enum linearDirection{
    58.         left_Right,
    59.         right_Left,
    60.         center_Right,
    61.         center_Left
    62.     }; public linearDirection linearPoint;
    63.     [Tooltip("Move with one direction or play ping pong")]
    64.     public bool pingPong = true;
    65.     [Tooltip("The spin progress over given duration; Note: clinch with 'Linear Magnitude'")]
    66.     public float spinMotion;
    67.     public enum spinMotionType {
    68.         Linear,
    69.         Wave
    70.     }; public spinMotionType spinFlow;
    71.     public enum spinDirection{
    72.         left_Right,
    73.         right_Left,
    74.         center_Right,
    75.         center_Left
    76.     }; public spinDirection spinPoint;
    77.     [Tooltip("Merry-go-around or not")]
    78.     public bool swingBack = false;
    79.     [Tooltip("As it says; offset vertically and/or horizontally -_-")]
    80.     public Vector2 masterOffset;
    81.     [Tooltip("Offset rotation, but only in z-axis, any problem with that?! Note: doesn't spin over time, use bullet formula instead or use emitter and make it spin via other script (or animation?)")]
    82.     public float masterRotation;
    83. }
    84.  
    85. [System.Serializable]
    86. public class TimeLine {
    87.     [Header("Bullet Time:")]
    88.     [Tooltip("Time in seconds to start the bullet party")]
    89.     public float start;
    90.     [Tooltip("Time in seconds to finish one pattern")]
    91.     public float duration;
    92.     [Tooltip("One more duration to repeat the pattern")]
    93.     public int repeat;
    94.     [Tooltip("Number of bullet emits in one span of duration harmonizing with pattern; Note: minimum fire rate will not less than 0.1 sec, or else actionPulse will be deducted")]
    95.     public int actionPulse;
    96.  
    97.     [Header("Bullet Element:")]
    98.     [Tooltip("To certainly choose none, input less than 0")]
    99.     public int pattern;
    100.     [Tooltip("To certainly choose none, input less than 0")]
    101.     public int formula;
    102.     [Tooltip("To certainly choose none, input less than 0")]
    103.     public int modification;
    104. }
    105.  
    106. [System.Serializable]
    107. public class BulletSpawn {
    108.     [Tooltip("Your title, definition, description, speech, message, or whatever; :Optional:")]
    109.     public string name;
    110.     public GameObject bulletPrefab;
    111.     [Tooltip("Spawn point: object attached with this script act as default emitter, if leave empty")]
    112.     public List<GameObject> emitter;
    113.     public List<TimeLine> bulletTime;
    114. }
    115.  
    116. [System.Serializable]
    117. public class Bulletflow {
    118.     /* Note: for the future viewer; why no 'public bool active'?
    119.      * No need, I found it useless; use/code timeHalt + reset = inactive (if you want to extend this code)... */
    120.     public bool reset;
    121.     public bool timeHalt;
    122.     public bool looping;
    123.     [Tooltip("Set loopQuantity to zero for infinite loop")]
    124.     public int loopQuantity;
    125.     [Tooltip("What for? Delay the start time of timeCode")]
    126.     public float delayStart;
    127.     [Tooltip("Behold the time holder! NOLI ME TANGERE, if you don't know me what I am for")]
    128.     public float timeCode;
    129. }
    130.  
    131. public class HellBulletManager : MonoBehaviour {
    132.  
    133.     public Transform test;
    134.     [Header("Bullet Manager:")]
    135.     public Bulletflow bulletRush;
    136.     public List<BulletSpawn> hellBullets;
    137.  
    138.     [Header("Bullet Transform:")]
    139.     public List<TransformPattern> bulletPattern;
    140.  
    141.     [Header("Bullet Properties:")]
    142.     public List<TransformFormula> bulletFormula;
    143.     public List<BulletModification> bulletModification;
    144.  
    145.     // Use this for initialization
    146.     void Start () {
    147.         if (bulletFormula.Count > 0)
    148.             foreach (TransformFormula thisFormula in bulletFormula)
    149.             {
    150.                 //using [Range(min,max)] and min set to 1, but the default stay to 0; this is use to fix the min when game starts
    151.                 if (thisFormula.linearAmount == 0)
    152.                     thisFormula.linearAmount = 1;
    153.                 if (thisFormula.rayAmount == 0)
    154.                     thisFormula.rayAmount = 1;
    155.             }
    156.     }
    157.  
    158.     void Update () {
    159.         //Debug.Log((hellBullets[0].bulletPrefab[0]));
    160.         if (bulletRush.reset)
    161.         {
    162.             bulletRush.reset = !bulletRush.reset;
    163.             bulletRush.timeCode = 0f;
    164.         }
    165.  
    166.         if (bulletRush.timeHalt)
    167.         {
    168.             return;
    169.         }
    170.  
    171.         if (bulletRush.delayStart > 0f)
    172.         {
    173.             bulletRush.delayStart -= Time.deltaTime;
    174.             if (bulletRush.delayStart < 0f)
    175.                 bulletRush.delayStart = 0f;
    176.         }
    177.         else
    178.         {
    179.             bulletRush.timeCode += Time.deltaTime;
    180.         }
    181.  
    182.         //Debug.Log((hellBullets[0].bulletPrefab));
    183.         //Make sure taken out all List with null bulletSpawn.bulletPrefab --- Lambda syntax 'COOL AND POWERFUL' they say!
    184.         hellBullets.RemoveAll (BulletSpawn => BulletSpawn.bulletPrefab == null);
    185.         if (hellBullets.Count > 0)
    186.         {
    187.             foreach (BulletSpawn thisBullet in hellBullets)
    188.             {  
    189.                 if (thisBullet.bulletTime.Count > 0) {
    190.                     foreach (TimeLine thisTime in thisBullet.bulletTime)
    191.                     {
    192.                         //Debug.Log ("Watching here! No Error Appear...");
    193.                         //Debug.Break ();
    194.                         if (bulletRush.timeCode >= thisTime.start && thisTime.duration > 0f)
    195.                         {
    196.                             //Debug.Log ("Gotcha! Error Appeared here!"); //Why? Is foreach something to do with this? // Unity 5.4.1f1 (64-bit)
    197.                             //Error: ArgumentOutOfRangeException: Argument is out of range. Parameter name: index
    198.                             //Debug.Break ();
    199.                             float pulseGap = thisTime.duration / thisTime.actionPulse;
    200.  
    201.                             if (pulseGap < 0.1f) {
    202.                                 thisTime.actionPulse = Mathf.FloorToInt(thisTime.duration / 0.1f);
    203.  
    204.                                 if (thisTime.actionPulse == 0)
    205.                                     return;
    206.  
    207.                                 pulseGap = thisTime.duration / thisTime.actionPulse;
    208.                             }
    209.  
    210.                             Debug.Log ("Destination A-1: Went here successfully!");
    211.                             StartCoroutine (startRespawn (thisBullet.bulletPrefab, thisBullet.emitter, pulseGap, thisTime.repeat, thisTime.pattern, thisTime.formula, thisTime.modification));
    212.                             Debug.Log ("Destination A-2: Went here successfully!");
    213.                         }
    214.                     }
    215.                 }
    216.             }
    217.         }
    218.     }
    219.     /*
    220.     void FixedUpdate ()
    221.     {
    222.         if (bulletRush.timeHalt)
    223.         {
    224.             //return;
    225.         }
    226.  
    227.         //code here..
    228.     }
    229.     */
    230.     IEnumerator startRespawn (GameObject bullet, List<GameObject> emitters, float fireRate, int repeat, int pattern, int formula, int modification)
    231.     {
    232.         TransformPattern patternApply;
    233.         TransformFormula formulaApply;
    234.         BulletModification modApply;
    235.  
    236.         bool patternExist = false;
    237.         Vector3 respawnOffset;
    238.         Vector3 masterOffset;
    239.         Quaternion masterRotation;
    240.         bool formulaExist = false;
    241.         bool modificationExist = false;
    242.  
    243.         Debug.Log ("Destination B-1: Went here successfully!");
    244.         //The game will run but gives me a message error, I don't know where cause of this specifically, may here or above there? Error: ArgumentOutOfRangeException: Argument is out of range. Parameter name: index
    245.         if (bulletPattern[pattern] != null) { //Checking... if (bulletPattern[pattern] == null) never assigned 'patternApply = bulletPattern [pattern];'...
    246.             patternExist = true;
    247.             patternApply = bulletPattern [pattern];
    248.             respawnOffset = new Vector2 (Random.Range (-patternApply.respawnOffset.x, patternApply.respawnOffset.x), Random.Range (-patternApply.respawnOffset.y, patternApply.respawnOffset.y));
    249.             masterOffset = transform.position + new Vector3 (patternApply.masterOffset.x, patternApply.masterOffset.y);
    250.             masterRotation = transform.rotation * Quaternion.Euler (0f, 0f, patternApply.masterRotation);
    251.         } else {
    252.             respawnOffset = Vector3.zero;
    253.             masterOffset = Vector3.zero;
    254.             masterRotation = Quaternion.identity;
    255.             //patternApply = null;
    256.         }
    257.  
    258.         Debug.Log ("Destination B-2: Went here successfully!");
    259.         if (bulletFormula [formula] != null) { //if (bulletFormula.Exists(TransformFormula => bulletFormula[formula])) /* <- Sample only: trying '.Exists' for alternatives, but give me some errors; I don't know really how to use it... or how about some '.Contain'? I don't know about it, please help me... THANKS */
    260.             formulaExist = true;
    261.             formulaApply = bulletFormula [formula];
    262.         }
    263.  
    264.         Debug.Log ("Destination B-3: Went here successfully!");
    265.         if (bulletModification[modification] != null) { //if (bulletModification.Exists(bulletModification[modification]))
    266.             modificationExist = true;
    267.             modApply = bulletModification [modification];
    268.         }
    269.  
    270.         //Transform bulletDirector;
    271.  
    272.         Debug.Log ("Destination B-4: Went here successfully!");
    273.         if (emitters != null || emitters.Count == 0)
    274.             Instantiate (bullet, transform.position + respawnOffset + masterOffset, transform.rotation * masterRotation);
    275.         /*else
    276.             foreach (Transform emitter in emitters)
    277.             {
    278.                
    279.             }*/
    280.         Debug.Log ("Destination B-5: Went here successfully!");
    281.         yield return null;
    282.     }
    283. }
    Thank you, your help is much appreciated... :D
     

    Attached Files:

    Last edited: Jul 20, 2017
    ejhbarker likes this.
  2. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    You don't say which line this occurs.

    Anyway, all that exception means is that the index into the list is not valid. Either it's less than zero or it's greater than or equal to the list size. It needs to be 0..N-1, where N is the list size. Find out what the invalid value is by printing it out or stepping with the debugger then backtrack to work out why it is that value.
     
    Ultimate360 likes this.
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    With foreach loops, if anything is the loop is removed while you're iterating through it, you'll get an argument out of range error usually. That's about the only thing that I can see that might give you the error.
     
  4. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Typically that'd be an InvalidOperationException.

    My guess is one of the indices you're passing to the coroutine is no good since it appears to be the only place you're accessing the lists by index.
     
    Jorgevy likes this.
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    I stand corrected, as I don't make it a habit of doing that.
     
    KelsoMRK likes this.
  6. Ultimate360

    Ultimate360

    Joined:
    Oct 28, 2016
    Posts:
    27
    Thank you guys for your reply, I really appreciate it, and @andymads thank you for enlighten me. Why didn't I even see the obvious, I been blind. Maybe I spend to much coding, and I google for solution and see that varArray != null; then there I'm stuck, can't think flexible.

    Anyway, back then I set pattern value to 1 from bulletTime as parameter to pattern list element from bulletPattern with index of 0 as 1st list where index 1 was out of range. But still, what's in my mind before, my mistake is that I depend to "bulletPattern[pattern] != null" where I thought out of range List/array is equivalent to null, but it is not? Went I read your post, it pop up in my mind why did I even try to go through the wall even there's another way, so this what I use before:

    Code (CSharp):
    1. IEnumerator startRespawn (sendValue) { /*sendValue the parameter*/
    2.  
    3.   if(varList[sendValue] != null) { //I have check this; if the varList's index is out of range it will skip the whole script of startRespawn and return outside, meaning it won't go to else!
    4.   }
    5.  
    6. }
    ^ Using the sendValue as index with varList compare to null.

    Instead now I use: (it works as expected)
    Code (CSharp):
    1. IEnumerator startRespawn (sendValue) {
    2.  
    3.   if(sendValue >= 0 && sendValue <= varList.Count - 1) { //sendValue is more than or equal to 0 && sendValue is less than or equal to var.Count minus 1;
    4.   }
    5.  
    6. }
    ^ Using the sendValue as an int with the range of 0 to varList.Count - 1.

    Say, the List<TransformPattern> var is a List with Element 0 and Element 1 only, that's:
    var[0];
    var[1];

    But if the editor set with a value of -1 or 2 from hellBullets[0].bulletTime[0].pattern as to send as parameter to IEnumerator startRespawn. We will get something like this:
    Code (CSharp):
    1. IEnumerator startRespawn (2)
    2. if(var[2] != null)
    My question now: is there a proper way to check if the array/List is not out of range? If they're not null... certainly they're not null (the out of range array/List) as they skip the whole line of code after them when they put in condition, is there way to do it? Answer yes or no? I'm just curious. How about the something.Exist or something.Contain for? Or something else? Either way I use the new way now. I seriously want to know if there is though. Then case close once my question answered.
     

    Attached Files:

    Last edited: Jul 20, 2017
  7. Ultimate360

    Ultimate360

    Joined:
    Oct 28, 2016
    Posts:
    27
    Here's my fixed:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class HellBulletManager_New : MonoBehaviour {
    6.  
    7.     [Header("Bullet Manager:")]
    8.     public Bulletflow bulletRush;
    9.     public List<BulletSpawn> hellBullets;
    10.  
    11.     [Header("Bullet Transform:")]
    12.     public List<TransformPattern> bulletPattern;
    13.  
    14.     [Header("Bullet Properties:")]
    15.     public List<TransformFormula> bulletFormula;
    16.     public List<BulletModification> bulletModification;
    17.  
    18.     // Use this for initialization
    19.     void Start () {
    20.         if (bulletFormula.Count > 0)
    21.             foreach (TransformFormula thisFormula in bulletFormula)
    22.             {
    23.                 //using [Range(min,max)] and min set to 1, but the default stay to 0; this is use to fix the min when game starts
    24.                 if (thisFormula.linearAmount == 0)
    25.                     thisFormula.linearAmount = 1;
    26.                 if (thisFormula.rayAmount == 0)
    27.                     thisFormula.rayAmount = 1;
    28.             }
    29.     }
    30.  
    31.     void Update () {
    32.         //Debug.Log((hellBullets[0].bulletPrefab[0]));
    33.         if (bulletRush.reset)
    34.         {
    35.             bulletRush.reset = !bulletRush.reset;
    36.             bulletRush.timeCode = 0f;
    37.         }
    38.  
    39.         if (bulletRush.timeHalt)
    40.         {
    41.             return;
    42.         }
    43.  
    44.         if (bulletRush.delayStart > 0f)
    45.         {
    46.             bulletRush.delayStart -= Time.deltaTime;
    47.             if (bulletRush.delayStart < 0f)
    48.                 bulletRush.delayStart = 0f;
    49.         }
    50.         else
    51.         {
    52.             bulletRush.timeCode += Time.deltaTime;
    53.         }
    54.  
    55.         //Debug.Log((hellBullets[0].bulletPrefab));
    56.         //Make sure taken out all List with null bulletSpawn.bulletPrefab --- Lambda syntax 'COOL AND POWERFUL' they say!
    57.         hellBullets.RemoveAll (BulletSpawn => BulletSpawn.bulletPrefab == null);
    58.         if (hellBullets.Count > 0)
    59.         {
    60.             foreach (BulletSpawn thisBullet in hellBullets)
    61.             {
    62.                 Debug.Log ("Ammo found!");
    63.                 if (thisBullet.bulletTime.Count > 0) {
    64.                     foreach (TimeLine thisTime in thisBullet.bulletTime)
    65.                     {
    66.                         Debug.Log ("All set! Ready to Fire...");
    67.                         if (thisTime.active && bulletRush.timeCode >= thisTime.start && thisTime.duration > 0f)
    68.                         {
    69.                             Debug.Log ("Now Fire!");
    70.                             thisTime.active = false;
    71.                             float pulseGap = thisTime.duration / thisTime.actionPulse;
    72.  
    73.                             if (pulseGap < 0.1f) {
    74.                                 thisTime.actionPulse = Mathf.FloorToInt(thisTime.duration / 0.1f);
    75.  
    76.                                 if (thisTime.actionPulse == 0)
    77.                                     return;
    78.  
    79.                                 pulseGap = thisTime.duration / thisTime.actionPulse;
    80.                             }
    81.  
    82.                             Debug.Log ("Destination A-1: Went here successfully!");
    83.                             StartCoroutine (startRespawn (thisBullet.bulletPrefab, thisBullet.emitter, pulseGap, thisTime.repeat, thisTime.pattern, thisTime.formula, thisTime.modification));
    84.                             Debug.Log ("Destination A-2: Went here successfully!");
    85.                         }
    86.                     }
    87.                 }
    88.             }
    89.         }
    90.     }
    91.     /*
    92.     void FixedUpdate ()
    93.     {
    94.         if (bulletRush.timeHalt)
    95.         {
    96.             //return;
    97.         }
    98.  
    99.         //code here..
    100.     }
    101.     */
    102.     IEnumerator startRespawn (GameObject bullet, List<GameObject> emitters, float fireRate, int repeat, int pattern, int formula, int modification)
    103.     {
    104.         TransformPattern patternApply;
    105.         TransformFormula formulaApply;
    106.         BulletModification modApply;
    107.  
    108.         bool patternExist = false;
    109.         Vector3 respawnOffset;
    110.         Vector3 masterOffset;
    111.         Quaternion masterRotation;
    112.         bool formulaExist = false;
    113.         bool modificationExist = false;
    114.  
    115.         Debug.Log ("Destination B-1: Went here successfully!");
    116.         //pattern is more than or equal to 0 && pattern is less than or equal to bulletPattern.Count minus 1;
    117.         /*try take the minus 1 below, you'll still be inside but the patternApply will be invalid that will force the function to skip and return immediately outside to Destination A-2*/
    118.         if (pattern >= 0 && pattern <= bulletPattern.Count - 1) {
    119.             patternExist = true;
    120.  
    121.             Debug.Log ("Inside Destination B-1");
    122.             patternApply = bulletPattern [pattern];
    123.             Debug.Log ("You see this, because patternApply is NOT OUT OF RANGE, else stop and return automatically and send error");
    124.  
    125.             respawnOffset = new Vector2 (Random.Range (-patternApply.respawnOffset.x, patternApply.respawnOffset.x), Random.Range (-patternApply.respawnOffset.y, patternApply.respawnOffset.y));
    126.             masterOffset = transform.position + new Vector3 (patternApply.masterOffset.x, patternApply.masterOffset.y);
    127.             masterRotation = transform.rotation * Quaternion.Euler (0f, 0f, patternApply.masterRotation);
    128.         } else {
    129.             respawnOffset = Vector3.zero;
    130.             masterOffset = Vector3.zero;
    131.             masterRotation = Quaternion.identity;
    132.         }
    133.  
    134.         Debug.Log ("Destination B-2: Went here successfully!");
    135.         //formula is more than or equal to 0 && formula is less than or equal to bulletPattern.Count minus 1;
    136.         if (formula >= 0 && formula <= bulletFormula.Count - 1) {
    137.             formulaExist = true;
    138.  
    139.             Debug.Log ("Inside Destination B-2");
    140.             formulaApply = bulletFormula [formula];
    141.             Debug.Log ("You see this, because formulaApply is NOT OUT OF RANGE, else stop and return automatically and send error");
    142.         }
    143.  
    144.         Debug.Log ("Destination B-3: Went here successfully!");
    145.         //modification is more than or equal to 0 && modification is less than or equal to bulletPattern.Count minus 1;
    146.         if (modification >= 0 && modification <= bulletModification.Count - 1) {
    147.             modificationExist = true;
    148.  
    149.             Debug.Log ("Inside Destination B-3");
    150.             modApply = bulletModification [modification];
    151.             Debug.Log ("You see this, because modApply is NOT OUT OF RANGE, else stop and return automatically and send error");
    152.         }
    153.  
    154.         //Transform bulletDirector;
    155.  
    156.         Debug.Log ("Destination B-4: Went here successfully!");
    157.         if (emitters != null || emitters.Count == 0)
    158.             Instantiate (bullet, transform.position + respawnOffset + masterOffset, transform.rotation * masterRotation);
    159.         /*else
    160.             foreach (Transform emitter in emitters)
    161.             {
    162.              
    163.             }*/
    164.         Debug.Log ("Destination B-5: Went here successfully!");
    165.         yield return null;
    166.     }
    167. }
    and again thank you very much... even small details or implied one push me out of trouble...