Writing Custom Typing Waits (C#)
Adding Custom Typewriter Waits
// import the necessary Febucci namespaces
using Febucci.TextAnimatorCore;
using Febucci.TextAnimatorCore.Text;
using Febucci.TextAnimatorForUnity;
using UnityEngine;
[System.Serializable] // <--- remember to serialize your scriptables!
[CreateAssetMenu(fileName = "Custom Typewriter Waits")]
class CustomTypingWaits : TypingsTimingsScriptableBase
{
// --- put your properties here as normal
[SerializeField] float delay = .1f;
// custom waits when showing text
public override float GetWaitAppearanceTimeOf(CharacterData character, TextAnimator animator)
{
// example: skips spaces
if (char.IsWhiteSpace(character.info.character))
return 0;
return delay;
}
// custom waits when disappearing text
public override float GetWaitDisappearanceTimeOf(CharacterData character, TextAnimator animator)
{
// in this case, it's the same as appearances
return GetWaitAppearanceTimeOf(character, animator);
}
}