[BUG] UCC + UIS and RemoveAllOnDeath causes a bug

anisimov

New member
1. UCC 2.4.8 + UIS 1.2.10
2. Unity 2021.3.5
3. I think this is due to the fact that the death event is unsubscribed twice. Once in the integration, another time in the controller.
4. Open the Demo integration scene. In the CharacterInventoryBridge component toggle "RemoveAllOnDeath". Run game, call ImmediateDeath in the CharacterHealth component.
5. The full error message

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 <e40e5a8f982c4b618a930d29f9bd091c>:0)
Opsive.Shared.Events.EventHandler.ExecuteEvent[T1,T2,T3] (System.Object obj, System.String eventName, T1 arg1, T2 arg2, T3 arg3) (at <c8e5381e72fc4f3ba22ae5029e6e4da1>:0)
Opsive.UltimateCharacterController.Traits.Health.Die (UnityEngine.Vector3 position, UnityEngine.Vector3 force, UnityEngine.GameObject attacker) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Health.cs:553)
Opsive.UltimateCharacterController.Traits.CharacterHealth.Die (UnityEngine.Vector3 position, UnityEngine.Vector3 force, UnityEngine.GameObject attacker) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/CharacterHealth.cs:97)
Opsive.UltimateCharacterController.Traits.Health.OnDamage (Opsive.UltimateCharacterController.Traits.Damage.DamageData damageData) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Health.cs:455)
Opsive.UltimateCharacterController.Traits.CharacterHealth.OnDamage (Opsive.UltimateCharacterController.Traits.Damage.DamageData damageData) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/CharacterHealth.cs:81)
Opsive.UltimateCharacterController.Traits.Health.Damage (Opsive.UltimateCharacterController.Traits.Damage.DamageData damageData) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Health.cs:337)
Opsive.UltimateCharacterController.Traits.Health.Damage (System.Single amount, UnityEngine.Vector3 position, UnityEngine.Vector3 direction, System.Single forceMagnitude, System.Int32 frames, System.Single radius, UnityEngine.GameObject attacker, System.Object attackerObject, UnityEngine.Collider hitCollider) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Health.cs:312)
Opsive.UltimateCharacterController.Traits.Health.Damage (System.Single amount, UnityEngine.Vector3 position, UnityEngine.Vector3 direction, System.Single forceMagnitude, System.Int32 frames, System.Single radius, UnityEngine.GameObject attacker, UnityEngine.Collider hitCollider) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Health.cs:293)
Opsive.UltimateCharacterController.Traits.Health.Damage (System.Single amount, UnityEngine.Vector3 position, UnityEngine.Vector3 direction, System.Single forceMagnitude) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Health.cs:236)
Opsive.UltimateCharacterController.Traits.Health.ImmediateDeath (UnityEngine.Vector3 position, UnityEngine.Vector3 direction, System.Single forceMagnitude) (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Health.cs:588)
Opsive.UltimateCharacterController.Traits.Health.ImmediateDeath () (at Assets/Opsive/UltimateCharacterController/Scripts/Traits/Health.cs:565)
UIKillFeed.Update () (at Assets/Game/Scripts/UI/Game/KillFeed/UIKillFeed.cs:31)
 
That's odd, your code doesn't match mine. And I can't reproduce the error either.

Also this sort of error happen when an event that was subscribed doesn't have the correct parameter types.
I looked through the entire code and found one. But it was a custom script that is not part of UCC/UIS or the integration.

Can you do a ctrl+Shift+F to find all places where the '"OnDeath"' event are being used and make sure that they have the parameters <Vector3, Vector3, GameObject>.
 
That's odd, your code doesn't match mine. And I can't reproduce the error either.

Also this sort of error happen when an event that was subscribed doesn't have the correct parameter types.
I looked through the entire code and found one. But it was a custom script that is not part of UCC/UIS or the integration.

Can you do a ctrl+Shift+F to find all places where the '"OnDeath"' event are being used and make sure that they have the parameters <Vector3, Vector3, GameObject>.

When I comment out this line, everything works well. I'll dive into it and post if I find a reason.
1661862652128.png
 
Top