public void CreateBuilding(string buildingName) { findingPlacement = true; GameObject newBuilding = (GameObject) Instantiate(ResourceManager.GetBuilding(buildingName), ResourceManager.INVALID_POSITION, Quaternion.identity); tempBuilding = newBuilding.GetComponent<Building> (); if(tempBuilding != null) { tempBuilding.objectId = ResourceManager.GetNewObjectId(); tempBuilding.hitPoints = 0; tempBuilding.SetTransparentMaterial(notAllowedMaterial, true); tempBuilding.SetCollidersAsTrigger(true); findingPlacement = true; } else { Destroy(newBuilding); } }