destroying assets is not permitted to avoid data loss code example
Example: destroying assets is not permitted to avoid data loss
This is because the variable obstacle is referencing the asset.
What you need to do, is change
Instantiate(obstacle, new Vector3(x * 7.5f, y, z),Quaternion.identity);
to
obstacle = (GameObject) Instantiate(obstacle, new Vector3(x * 7.5f, y, z),Quaternion.identity);
Instead of destroying the instantiated object you were trying to destroy,
you were actually attempting to destroy the original due to not assigning
obstacle as the instantiated object.