I believe AkilaeTribe is correct; no scripts attached to that GameObject have a method “SetSelected”. Double-check that you’re targeting the correct GameObject and that its scripts have the method (check for typos!).
If your calling method is a bit general (in that sometimes your targeted GameObject may have the method and other times not), you can use an overload of SendMessage that won’t fire the error:gameObject.SendMessage("SetSelection", SendMessageOptions.DontRequireReceiver);But don’t use this as a crutch to avoid the error. If you expect that your target GameObject is supposed to have the method, then you should let the error fire because it will alert you to a logical oversight in your code.
Terrains don’t have a function “SetSelected,” as everyone above said.
It looks like your code is trying to ignore the terrain, though, so unless your nonTerrainLayers var is incorrect you shouldn’t need to worry about terrains being there or not.
You need to only message gameObjects with that function or you need to DontRequireReceiver it.