I'm workin on a RTS and as usual, there's the option to build structures.
in my case I create a Prefab Clone : Parent(Empty)->Model and change the Skin to green/red to indicate the building status. Once it's placed I'd like to already avoid the placeholder. Even if it's finished the units can still walk through the new object.
The particular function:
public void CreateBuilding(string buildingName, Vector3 buildPoint, Unit creator, Rect playingArea) //erstellt ein neues Gebäude
GameObject newBuilding = (GameObject)Instantiate(ResourceManager.GetBuilding(buildingName), buildPoint, new Quaternion());
tempBuilding = newBuilding.GetComponent<Building>();
tempBuilding.ObjectId = ResourceManager.GetNewObjectId();
tempCreator = creator;
findingPlacement = true;
tempBuilding.hitPoints = 0;
var guo = new GraphUpdateObject(tempBuilding.GetComponent<Collider>().bounds); //ToDo: A* Neu Scannen
I tried to follow the example from the documentation with the guo part but this doesnt work in this case. Maybe I misunderstood the function of this method.