Tower Defence game not working(Pls Help)

So i’ve been following this tutorial for hot to make a tower defence game. and on episode 2 i cant get my enemy example to move. here a link to the tutorial. and also the script i copied.

using UnityEngine;

public class Enemy : MonoBehaviour {


    public float speed = 10f;

    private Transform target;
    private int wavepointIndex = 0;

    void start ()
    {
        target = Waypoints.points[0];
    }
       
    void update()
    {
        Vector3 dir = target.position - transform.position;
        transform.Translate(dir.normalized * speed * Time.deltaTime, Space.World);

        if (Vector3.Distance(transform.position, target.position) <= 0.2f)
        {
            GetNextWayPoint();
        }

        }


    void GetNextWayPoint()
    {
        if(wavepointIndex >= Waypoints.points.Length - 1)
        {
            Destroy(gameObject);
        }

        wavepointIndex++;
        target = Waypoints.points[wavepointIndex];
    }

}

This belongs in the scripting forum, not game design.

Yes. Or possibly the getting-started forum. And when you repost, please provide more detail than “I can’t get my enemy example to move.” Besides writing this script, what have you done? Have you actually attached it to something? What is Waypoints, and does it have some waypoints actually set? Do you get any errors, or what?

Definitely not a game design issue, though. :slight_smile:

sorry, i’ll post somewhere else next time. im not used to forums

i attached the script to the enemy and also the waypoint script the the waypoint empty object. i’ve followed the tutorial to the letter, im not sure why my enemy isnt moving

I was having the same issue, I haven’t found out how to fix it

Can I see your Waypoints class