Hey,
I’m new at ScriptablObjects (“SO”) so my question might be basic.
I have a Patient SO. This Patient contains another SO wich is a Disease SO.
I’d like to generate a Patient with a random Disease picked from a List of Diseases (like a database).
Here’s some pseudocode :
public class emergencyRoom : MonoBehaviour {
public List<Patient> patients;
public List<Disease> diseases;
public int availableRoomsNumber = 6;
void Start () {
//here I'd like to fetch all the assets made from Disease SO,
// something like :
//diseases = AssetDatabase.Get........
for(int i = 1; i < availableRoomsNumber; i++)
{
//here I create a new Patient instance from Patient SO, and put it in the list of patients.
Patient newPatient = ScriptableObject.CreateInstance<Patient>();
patients.Add(newPatient);
//assign a random disease from the SO disease list.
patient.Disease = disease[Random.Range(0, disease.Count)]
}
Thank you very much for your help,
I am really looking forward to mastering SO