This class works out of the box by adding the GameObject‘s to Dictionaries when placed on the grid.
public static void AddTypeObject(int prefabId, GameObject obj)
This method is called when placing an object via the ObjectPlacer to add the object to the type dictionary.
The prefabId is initially set via the SelectObject button as it is useful to be able to obtain a list of all objects of type at once.
public static void RemoveTypeObject(int prefabId, GameObject obj)
This method does not delete objects, but removes them from the ObjectStorage Dictionary so they will not try to be accessed after being destroyed.
Note. If you destroy a GridObject via scripting outside of this packages scripts, you should be sure to use this method to also remove it from the Dictionary.
public static List<GameObject> GetObjectsOfType(int prefabId)
Returns a List<GameObject> should it find a list containing that prefabId.
The prefabId is initially set via the SelectObject button.
//A list containing all GameObjects with that ID. List<GameObject> GOList = ObjectStorage.GetObjectsOfType(0);