Setting abilities with TryStartAbility does not set the corresponding state

DankP3

Active member
1. Character controller variant (Ultimate Character Controller, First Person Controller, etc).
UCC 3.0.4
2. Unity version (include which SRP, beta Unity versions aren't supported)
Unity 2021.3.12f1
3. Bug description
Setting abilities with TryStartAbility does not set the corresponding state when it works correctly when the ability is started directly from input.

4. Steps to reproduce
Set an ability, eg. Aim, to manual and add a script to start Aim with TryStartAbility().
Observe Aim is active, but the Aim state is not set.
This can be replicated in the demo scene by setting the Aim ability to manual and adding a simple input driven script to start the ability

5. The full error message (if any)
N/A
 
Aim overrides AbilityStarted depending on how the aim ability was started. If you want to start it manually I recommend subclassing the Aim ability and ensuring the base AbilityStarted method is called. Aim works this way because it has to soft activate when in first person view.
 
Hmm, I guess I used a poor example to check reproducibility. I have my own custom ability. If I set it on button press it sets a state, but if I set with TryStartAbility it does not. It is not an ItemAbility. Presumably it should not do this in a non-Aim setting?
 
It is only the Aim ability that overrides this. Within your custom ability did you make sure to call base.AbilityStarted if you override the AbilityStarted method? A button down start type calls TryStartAbility similar to the manual start type.
 
Top