Hello, I’m using this code to spawn a prefab at mouse position, but I only want it to be allowed to be spawned in the area next to street. How can I do this?
if (place_power_plant_coal && Input.GetButtonDown("Fire1")) {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit)) {
Instantiate(__power_plant_coal, hit.point, Quaternion.identity);
}
}