- Home /
How to store a list of GameObjects with all components (scripts, colliders etc)
I'm storing information of all my buildings in my game in a List. Every building has a script attached with its info. I'm using a Save Tool, which loads the list again, if I start my game, the GameObjects appear, but without the necessary informations. Is there an easy way to fix this? Can I make a second List with all Scripts for examples and reattach them after restarting?
This is my List:
public static List<GameObject> buildingsList = new List<GameObject>();
And everything I'm doing at the moment is reloading this List in the Awake Method, and the buildins Appear, but without any informations.
private void Awake()
{
if (ES3.KeyExists("buildingsList"))
buildingsList = ES3.Load<List<GameObject>>("buildingsList");
else
Debug.Log("There aren't any buildings yet!");
}
Your answer
Follow this Question
Related Questions
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
Prefab Script List not being assigned as unique - can you see why? 1 Answer
How do I save a gameObject to a list so i can destroy in the scene? 1 Answer
Dynamically assign each ui.Text.text in list to the name of objects in another list 2 Answers
Trouble with Destroying and instantiating game objects on new scene 1 Answer