Realm Rush: After building game enemies no longer follow path correctly

The game functions as intended while in the editor and playing, but after building the game the enemies no longer follow the path in the proper tile order. I haven’t built any other games so the settings are default. Windows build.

The emey will start at a random path tile (same one though each time the game is run) and then travel to another random path tile.

This occurs in my own game and when I build the game by downloading the gitlab repo for this lecture (24) and building. I also tried to use the same Unity version 2020.1.16f1 and same issue.

Hi Saito,
The code for the FindPath() method was changed during this lecture, so should hopefully work as intended after making the required code edits.

The code should look like this:

void FindPath()
    {
        path.Clear();

        GameObject parent = GameObject.FindGameObjectWithTag("Path");

        foreach(Transform child in parent.transform) 
        {
            Waypoint waypoint = child.GetComponent<Waypoint>();

            if(waypoint != null)
            {
                path.Add(waypoint);
            }
        }
    }

It’s also worth checking that your waypoints are in the correct order in the hierarchy.

If you’ve done all of this and are still having issues then please let me know.

P.S. The code edit above was made after the course was completed, so is not included in the repo attached to this lecture.

1 Like

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

Privacy & Terms