Can terrain trees run their own script?

I’ve got a terrain covered in trees. The tree prefab has a script on it that doesn’t run for the terrain instantiated trees. Is it not possible to run scripts on terrain trees?
151779-tree.png

Not quite since Terrain trees are not regular GameObjects but you can do something similar by putting a script on the terrain itself that calls some method for each tree instance on the terrain.

TreeInstance[] trees;

void Start() {
	var terrain = GetComponent<Terrain>();
	trees = terrain.terrainData.treeInstances;

	foreach (var tree in trees) {
		...
	}
}

void Update() {
	foreach (var tree in trees) {
		...
	}
}

@BastianUrbach
How would I do this if I have 3 types of trees but only need to add a certain line of code to 1 of the 3? Please please help! It would save me hours of work!