I want to make the characterpersecond of the typewrittereffect to go faster if i held a button
Posted: Tue Jul 23, 2024 4:12 pm
I'm trying to setup the typical scenario when you want the text to be typed faster when pressed a certain button, in my case A from gamepad.
I set this on script to control it
public void SetSpeedBoost(bool isBoosted)
{
this.isBoosted = isBoosted;
if (typewriterEffect != null)
{
float newSpeed = isBoosted ? defaultSpeed * boostedSpeedMultiplier : defaultSpeed;
typewriterEffect.SetSpeed(newSpeed);
Debug.Log("Setting new speed");
}
else
{
Debug.LogError("TypewriterEffect no está asignado.");
}
}
i tried different ways to do it but according to the guide it needs to be made like this, but im having the problem that, yes, it goes faster when pressing the button, but when released, it waits a second or some time and then continues with the default speed.
any idea how to solve this?
I set this on script to control it
public void SetSpeedBoost(bool isBoosted)
{
this.isBoosted = isBoosted;
if (typewriterEffect != null)
{
float newSpeed = isBoosted ? defaultSpeed * boostedSpeedMultiplier : defaultSpeed;
typewriterEffect.SetSpeed(newSpeed);
Debug.Log("Setting new speed");
}
else
{
Debug.LogError("TypewriterEffect no está asignado.");
}
}
i tried different ways to do it but according to the guide it needs to be made like this, but im having the problem that, yes, it goes faster when pressing the button, but when released, it waits a second or some time and then continues with the default speed.
any idea how to solve this?