private GameObject InstantiateNewObject(PlaceableObject objectToPlace, Vector3 position, Quaternion rotation, Tile objectTile) { GameObject newObject = Instantiate(objectToPlace.gameObject, position, rotation, objectParent); levelManager.AddObjectToLists(newObject); //pathingGraph.UpdateGrapthBounds(objectToPlace.GetObjectBounds()); if (CheckIfMachineOrPlaceable(ObjectToPlace)) { economyManager.OnMachinePurchase(ObjectToPlace as Machine); } else { economyManager.OnBuildingPartPurchase(ObjectToPlace); } PlaceableObject newPlaceableObject = newObject.GetComponent <PlaceableObject>(); newPlaceableObject.PlacedOnTile = objectTile; newPlaceableObject.PrefabName = objectToPlace.name; objectTile.SetIfPlacedOn(true); levelManager.GetLevelCamera().SetRotationLock(false); return(newObject); }