Cast Time Abilities
ππ»
5
π₯
1
Here’s how you can import Cast Times to your Abilities, it’s super simple too!
Note that this does not come with a cast time bar, only the actual system itself
First of all, start by adding those lines in the ActiveAbilitySheet script
[Header("Cast Settings")]
[SerializeField, Min(0f)] private float m_castTime = 0f; // seconds, 0 = instant
[SerializeField] private bool m_interruptOnDamage = true; // cancel when damaged
[SerializeField] private bool m_lockMovementWhileCasting = true; // disable Move/Interact/UseAbility during cast
public float castTime => m_castTime;
public bool interruptOnDamage => m_interruptOnDamage;
public bool lockMovementWhileCasting => m_lockMovementWhileCasting;
After that, just replace your ProjectileAbility script with the one i attached
And you’re done! Now just set the amount of cast time you want an ability to take to cast on the ability prefab(s)!

π¬ Comments (26)
Yeah i was thinking of doing that actually, i can look into it right now!
but now that you here i do have a request, would you be able to make a cast time bar addon? π
not a must of course but im just shooting my shot lol
okay first of all, add
using System.Collections;at the top of the scriptthen, under your existing fields (after m_projectiles list), add:
After that, replace your current
protected override void Fire()with:Then after that, add this whole method below
Fire();ProjectileAbilityscript ^@SvanDark see if it suits you You can put it anywhere (in my case i just put it in the ability prefab) and call (uiCountdownBar.show(<nΒΊ_seconds>)). IΒ΄ve also provided a way to say if you want to fill or reduce(default), just use a second parameter (uiCountdownBar.show(<nΒΊ_seconds>, <boolean => fill> )).
(note in my case only appears in the combo, i.e. in the tree shot ability… and i also added some camera shake for niceness!)
One thing that would make it even better is making it wow style ish and putting the name of the ability in the actual bar, but that would also mean that you have to make the bar bigger lol
Obviously this is not a must since it might be a bit too much for users, but once again this is amazing!
Want to continue the conversation?