I am trying to add a randomly generated transform to a list. Doing the following gives me a runtime error saying NullReferenceException at the 5th line. What am I doing wrong? Also is there a better way to add a Transform to a list? Sorry if I made any mistakes as this is my first time on Stack Overflow.
start()
{
GameObject createdObject = new GameObject();
createdObject.transform.position = new Vector3(5f, 5f, 5f);
waypoints.Add(createdObject.transform);
}