Hi there guys
I’m a bit stumped why the following is giving me a null reference exception. I have my iwn struct that i use to save some info and put that in a List called pageList and of type lessonPage. Here is the code that populate the properties and Lists in my type:
if (GUI.Button(new Rect(camera.pixelRect.xMin + 330, yPos - camera.pixelHeight + 210, 100, 40), "ADD PAGE"))
{
lessonPage lp = new lessonPage();
lp.pageName = PageName;
lp.totalTime = createNewTimePoint.totalTime;
foreach (GameObject tp in GameObject.FindGameObjectsWithTag("timePoint"))
{
lp.clockName.Add(tp.name);
lp.clockPosition.Add(tp.transform.position);
lp.clockTime.Add(tp.GetComponent<timePointBehaviour>().timeValue);
lp.clockText.Add(tp.GetComponent<timePointBehaviour>().thisPointText);
}
}
The lp.PageName and lp.totalTime seems to work fine, but the first line in hte loop gives the error and when I comment that out, the next etc. I dont get it…