Edit. I found the problem. I had the SetMovementSpeed function twice in my code. Only realised that after posting about it here. Feel really stupid at the moment. No need to help anymore
Hi!
For some reason the I cannot set the movement speed of an attacker to 0 when the attack animation starts. I am able to set an animation event at the start of the attack animation but when I choose the SetMovementSpeed function from the dropdown list, Unity wonât allow me to choose the speed. Instead of having the option to change the speed parameter it only has this text:
âSome functions were overloaded in monobehaviour components and may not work as intended is used with animation eventsâ.
However, if choose the DealDamage option, Unity allows me to change the value of the float parameter. With SetMovementSpeed I am unable to do that.
Hereâs the code from my Atttacker Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Attacker : MonoBehaviour
{
[Range (0f, 5f)]
float currentSpeed = 1f;void Update() { transform.Translate(Vector2.left * currentSpeed * Time.deltaTime); } public void SetMovementSpeed() { } public void SetMovementSpeed (float speed) { currentSpeed = speed; }
}
Any ideas what might be causing this and what is the fix? Thanks!