Enemy Not Spawning

When i play my Level scene the enemy spawn fine but if i load the scene from the start menu no enemy spawn.
this is the error that pops up

NullReferenceException: Object reference not set to an instance of an object
EnemyPathing.move () (at Assets/scripts/EnemyPathing.cs:31)
EnemyPathing.Update () (at Assets/scripts/EnemyPathing.cs:20)

and the EnemyPathing script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyPathing : MonoBehaviour
{
    waveconfig waveConfig;
    List<Transform> waypoints;
    int waypointIndex = 0;

    private void Start()
    {
        waypoints = waveConfig.GetWaypoints();
        transform.position = waypoints[waypointIndex].transform.position; 

    }

    private void Update()
    {
        move();

    }

    public void SetWaveConfig(waveconfig waveConfig)
    {
        this.waveConfig = waveConfig;
    }

    private void move()
    {
        if (waypointIndex <= waypoints.Count - 1)
        {
            var targetPosition = waypoints[waypointIndex].transform.position;
            var movementThisFrame = waveConfig.GetMoveSpeed() * Time.deltaTime;
            transform.position = Vector2.MoveTowards
                (transform.position, targetPosition, movementThisFrame);

            if (transform.position == targetPosition)
            {
                waypointIndex++;
            }

        }
        else
        {
            Destroy(gameObject);
        }
    }
}

also the waves in the wave Configs list disappear when loading from the menu

playing from level 1 scene

playing after loading from start menu

please help iv been trying to figure this one out for a while now

thank you

I have fixed the problem after a lot of time spent trying to figure it out i ended up just copy and pasting the code from the lecture the only difference i could see was i was missing capital letters for waveConfig and not sure if it makes a difference bu i renamed some scripts .

Thank you Rob for your help and anyone else who spent time reading my problem.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.