Store Reference to a Serializable Class
I'd like to store a reference to a serializable Class thats is inside an other Array. At the moment i have the workaround with IDs, but it's inconvenient to get the entity every time through ID.
class Database : MonoBehaviour
{
public Worker[] workers;
public WorkGroup[] groups;
}
[System.Serializable]
class Worker
{
int id;
public string name;
public WorkGroup group; // No Reference possible
// Saves it intern as struct
int groupID; //Workaround
}
[System.Serializable]
class WorkGroup
{
int id;
public string name;
}
Comment
Your answer
Follow this Question
Related Questions
How to save multiple scenes' data 2 Answers
Unity How to Save Serialized Levels 1 Answer
Save Timer HighScore 2 Answers
Can't build my Project 1 Answer
public bool not showing in inspector 1 Answer