In unity my game would work fine, it would have errors but they weren’t fatal but when I rendered the game it would crash when I start it, any suggestions?
You need to fix all the red errors, and it would not hurt to fix all others. It looks like either you’ve spelled the name of the tag incorrectly or have failed to define the tag ‘waypoint’. Capitalization matters. Waypoint != waypoint != waypoints… So that means that when you do:
wayPoints = GameObject.FindGameObjectsWithTag("waypoint");
You are getting back a list with nothing in it. So when you do attempt to access with wayPoints[rand] you get more errors because are attempting to access information from an empty list. This type of error will typically run in the editor but will crash a device.
A couple of notes:
- When you post error messages and the code, you need to double click on the error and then add a comment to the line that has the error. The line number in the listing below do not line up with the line numbers in the listing, and knowing what lines the errors occur on is a huge help in figure out what is going on.
- By posting followup information as answers, your question is now marked as having two answers (though you’ve not received any answers yet). Having it marked as having two answers makes it far more likely that people answering questions will not look at your question. You can convert your answers below to comments using the ‘more’ drop-down at the bottom of each answer.