Hello!
I’m trying to make a game where you run a hospital, accept patients and treat them. The first thing you should do each morning is check a list of possible patients where you’ll get 4 new random patients each day. I’ve made a script that assigns a random sprite from a pool of possible sprites to each patient in the Awake method. This works fine if you just add a GameObject with this script attached to the scene.
Problem is, I’m not physically adding any patients here, just adding their information to a list that should display their name, symptoms and photo. Since no such GameObject exists in the scene, everytime I check the list I receive an Unassigned Reference Exception from the spriteRenderer variable in the patient script.
This makes sense, I understand where the error is coming from, but how could I possibly fix it?