I’m making an attack script with a normal attack (tap key), and a charged attack (hold key). When I hold the key to chrage, it charges and does a normal attack. Is there any way that I can fix this? Any help is appreciated.
Here is a way you can achieve the effect you want:
float holdStartTime = 0f;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
holdStartTime = Time.time;
}
if (Input.GetMouseButtonUp(0))
{
float delta = Time.time - holdStartTime;
if (delta > 0.1)
{
//held longer than .1 second click
// do special attack
}
else
{
// do normal attack
}
}
}