Do-Good-Games / NoCapstone2023

The repository for the game made by the NoCapstone group at DU in Spring 2023.
1 stars 0 forks source link

asteroid coroutine throws index out of range exception on boost #74

Closed RyanDavidsonDev closed 9 months ago

RyanDavidsonDev commented 9 months ago

at the end of destroyAsteroid(), the very last line StartCoroutine()

my guess is the coroutine is already being destroyed elsewhere?

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0) AudioReference.GetRandomClip (System.Boolean setNewIndex) (at Assets/Scripts/Sounds/AudioReference.cs:39) Asteroid+d__16.MoveNext () (at Assets/Scripts/Entities/Asteroids/Asteroid.cs:83) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) Asteroid:DestroyAsteroid() (at Assets/Scripts/Entities/Asteroids/Asteroid.cs:126) Asteroid:Damage(Int32) (at Assets/Scripts/Entities/Asteroids/Asteroid.cs:55) Projectile:OnTriggerEnter2D(Collider2D) (at Assets/Scripts/Entities/Projectile.cs:69)

RyanDavidsonDev commented 9 months ago

sound references hadn't been attached to gold or explosive asteroid objects