the thing is i need a list of strings to be serialized and stored in the hard drive. To do that a followed the live training on persistent data, and tried to do the same. There are two scripts, one is GameManager
public class GameManager : MonoBehaviour
{
public static GameManager manager;
public string un;
public List<string> names;
void Start()
{
names.Add("Johny");
names.Add("Nate");
print(names);
}
}
and the other script adds names to the names list in GameManager
public class AddNamee : MonoBehaviour {
void Start()
{
GameManager.manager.names.Add("Karim");
}
}
when i run this i get the following error:
NullReferenceException: Object reference not set to an instance of an object
AddNamee.Start () (at Assets/AddNamee.cs:19)