Detecting OnMouseDown from colliders in an array

I am making a game where you have to select regions. Every region has its own collider that you click to select it. I have around 50 regions, and I don’t want to make a script for every single one to tell when it has been clicked. Is there a way to make an array or a list in one script and then have it test each collider for all the other regions by itself?

You don’t really need an array for this. Just place this on your camera.

void Update ()
{
	Vector3 mousePos = Input.mousePosition;

	Ray ray = Camera.main.ScreenPointToRay(mousePos);
	RaycastHit hitInfo;

	if (Physics.Raycast(ray, out hitInfo) && Input.GetMouseButtonDown(0))
	{
		curRegion = hitInfo.transform.gameObject;
	}
}

This will fire a raycast through screen space wherever your cursor is located. Then whichever you click will set the curRegion variable to that clicked object. You may also want to check to make sure you are clicking only regions by setting a tag for all regions and then add this in your if statement:

if (hitInfo.transform.tag == "Regions")