Tricks and Tips

Here I think Range Should Be Start With 0.0001 or greater beacuse c# can’t multiply any number with 0 “Zero”

public class Enemy : MonoBehaviour
{
[SerializeField] Transform path;
[SerializeField] [Range(0f,5f)]float speed = 1;

C# can absolutely multiply by 0 (zero), you simply cannot DIVIDE by zero. Multiplication by 0 simply results in 0, and in this case, results in a speed of 0, so the enemy stops. Can be useful in a tower defense if you want to use towers that slow movement, or completely halt movement, like an ice tower, that can temporarily set the enemies movement speed to 0.

Privacy & Terms