[BUG] UMA created character, ItemAbility set InputNames

revenz

New member
Hi,

When creating a UMA character, and adding a ItemAbility. If you try to set the InputNames on one of those abilities, there is no way to update the fields
- m_ActiveInput
- m_ButtonUp
So a null exception is throw
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Character.Abilities.Ability.CanInputStartAbility (Opsive.Shared.Input.PlayerInput playerInput) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:370)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:130)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:99)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:73)

My line numbers may have changed during a vscode code format, but the offending line is
if (m_ActiveInput && !CanReceiveMultipleStarts)

inside the CanInputStartAbility method.

The fix for this is to alter the setter of InputNames to the following

public string[] InputNames
{
get { return m_InputNames; }
set
{
m_InputNames = value;
m_ButtonUp = new bool[m_InputNames.Length];
for (int i = 0; i < m_InputNames.Length; ++i)
{
m_ButtonUp = true;
}
m_ActiveInput = new bool[m_InputNames.Length];
}
}


Is there another way of doing this, or can you include this in a future version?

TIA
 
Top