//Remove the given object to the map hierarchy and make object selection script private void RemoveObjectFromMap(GameObject objectToRemove) { //Remove the object from the object selection script ObjectSelection.Instance.RemoveSelectable(objectToRemove); //Remove the object from the script dictionary ObjectScriptTable.Remove(objectToRemove); //Delete the object itself Destroy(objectToRemove); }
//Add the given object to the map hierarchy and make it selectable private void AddObjectToMap(GameObject objectToAdd, MapObject objectScript) { //Make the new object a child of the map root. objectToAdd.transform.parent = Instance.mapRoot.transform; //Make the new object selectable ObjectSelection.Instance.AddSelectable(objectToAdd); //Add the object and its MapObject script to the dictionary ObjectScriptTable.Add(objectToAdd, objectScript); }