// public int AddToNewFamily() // { // familyID = peopleController.AddFamily(); // peopleController.FindFamilyByID(familyID).AddMember(this); // return familyID; // } public void AddToFamily(int id_) { // Remove this person from the family he/she was assigned if (familyID != -1) { if (gameObject.activeSelf) { RemoveFromFamily(); } else { familyID = -1; } } Family family = peopleController.FindFamilyByID(id_); // If the family exists if (family != null) { Debug.Log("I join to this family!"); familyID = id_; if (gameObject.activeSelf) { family.AddMember(this); } } // If the family does not exist else { Debug.Log("Im loading data and i needed to create one family"); int newID = peopleController.AddKnownFamily(id_); AddToFamily(newID); } }