1. Character controller variant (Ultimate Character Controller, First Person Controller, etc).
Third Person Controller
2. Unity version (include which SRP, beta Unity versions aren't supported)
2019.3.9f1
3. Bug description
- I have a Ability "Throw" and "Throwable" which works similiar to "Ride" and "Rideable" in that regards that it adds/removes colliders of the Throwable/Rideable.
- The Character with the "Throwable" also uses the Character Respawner
- In CharacterHealth.OnRespawn I get an IndexOutOfRangeException because "m_CharacterLocomotion.Colliders" has an element that is null due to "Throw" and "Throwable"
Changing Assets/Opsive/UltimateCharacterController/Scripts/Traits/CharacterHealth.cs:126-130 to iterate over "m_ColliderGameObjects.Length" fixes the problem for me:
4. Steps to reproduce
No explicit test case yet
5. The full error message (if any)
IndexOutOfRangeException: Index was outside the bounds of the array.
Opsive.UltimateCharacterController.Traits.CharacterHealth.OnRespawn () (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/CharacterHealth.cs:128)
Opsive.Shared.Events.InvokableAction.Invoke () (at <e1dc8cf082ab4226a2cfe9b11461b1b5>:0)
Opsive.Shared.Events.EventHandler.ExecuteEvent (System.Object obj, System.String eventName) (at <e1dc8cf082ab4226a2cfe9b11461b1b5>:0)
Opsive.UltimateCharacterController.Traits.Respawner.Respawn (UnityEngine.Vector3 position, UnityEngine.Quaternion rotation, System.Boolean transformChange) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Respawner.cs:197)
Opsive.UltimateCharacterController.Traits.CharacterRespawner.Respawn (UnityEngine.Vector3 position, UnityEngine.Quaternion rotation, System.Boolean transformChange) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/CharacterRespawner.cs:39)
Opsive.UltimateCharacterController.Traits.Respawner.Respawn () (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Respawner.cs:164)
Opsive.Shared.Game.ScheduledEvent.Invoke () (at <b31995186aab4d358c1b20c14faa05b8>:0)
Opsive.Shared.Game.SchedulerBase.Invoke (Opsive.Shared.Game.ScheduledEventBase scheduledEvent, System.Int32 index) (at <b31995186aab4d358c1b20c14faa05b8>:0)
Opsive.Shared.Game.SchedulerBase.Update () (at <b31995186aab4d358c1b20c14faa05b8>:0)
Thanks!
Third Person Controller
2. Unity version (include which SRP, beta Unity versions aren't supported)
2019.3.9f1
3. Bug description
- I have a Ability "Throw" and "Throwable" which works similiar to "Ride" and "Rideable" in that regards that it adds/removes colliders of the Throwable/Rideable.
- The Character with the "Throwable" also uses the Character Respawner
- In CharacterHealth.OnRespawn I get an IndexOutOfRangeException because "m_CharacterLocomotion.Colliders" has an element that is null due to "Throw" and "Throwable"
Changing Assets/Opsive/UltimateCharacterController/Scripts/Traits/CharacterHealth.cs:126-130 to iterate over "m_ColliderGameObjects.Length" fixes the problem for me:
Code:
if (m_DeathLayer != 0) {
for (int i = 0; i < m_ColliderGameObjects.Length; ++i) {
m_ColliderGameObjects[i].layer = m_ColliderLayers;
}
}
No explicit test case yet
5. The full error message (if any)
IndexOutOfRangeException: Index was outside the bounds of the array.
Opsive.UltimateCharacterController.Traits.CharacterHealth.OnRespawn () (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/CharacterHealth.cs:128)
Opsive.Shared.Events.InvokableAction.Invoke () (at <e1dc8cf082ab4226a2cfe9b11461b1b5>:0)
Opsive.Shared.Events.EventHandler.ExecuteEvent (System.Object obj, System.String eventName) (at <e1dc8cf082ab4226a2cfe9b11461b1b5>:0)
Opsive.UltimateCharacterController.Traits.Respawner.Respawn (UnityEngine.Vector3 position, UnityEngine.Quaternion rotation, System.Boolean transformChange) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Respawner.cs:197)
Opsive.UltimateCharacterController.Traits.CharacterRespawner.Respawn (UnityEngine.Vector3 position, UnityEngine.Quaternion rotation, System.Boolean transformChange) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/CharacterRespawner.cs:39)
Opsive.UltimateCharacterController.Traits.Respawner.Respawn () (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Respawner.cs:164)
Opsive.Shared.Game.ScheduledEvent.Invoke () (at <b31995186aab4d358c1b20c14faa05b8>:0)
Opsive.Shared.Game.SchedulerBase.Invoke (Opsive.Shared.Game.ScheduledEventBase scheduledEvent, System.Int32 index) (at <b31995186aab4d358c1b20c14faa05b8>:0)
Opsive.Shared.Game.SchedulerBase.Update () (at <b31995186aab4d358c1b20c14faa05b8>:0)
Thanks!
Last edited: