I’d like to call a common method for all GameObjects tagged as Collectable. I get a syntax error with the following. Is there a way to do this? 
void OnTriggerEnter2D ( Collider other )
{
if (other.gameObject.tag == "Collectable")
other.gameObject.Collected();
}
You need to get the script on the gameObject that the method is in.
other.gameObject.GetComponent<ScriptName>().Collected()
Ah, thank you. That makes sense.
Is there any way to get a component generically? So if any item with the tag “Collectable” is triggered, the same method for all GameObjects with that tag will be called for any attached script.
I found a solution. I send a message to the GameObject from the collision and trigger the generic function. An exception is thrown if the message has no receiving function, but otherwise, it’s working.
In the OnEnterTrigger2d method:
if (other.gameObject.tag == "Collectable")
other.gameObject.SendMessage ("Collect");
An in every GameObject tagged Collectible, a definition for the method:
void Collect()
{
Debug.Log ( "W00T" );
}