Basic SphereCast?

Hey gang I’m trying to understand SphereCast :slight_smile:
(I have my ships fly around my map, and when you enter their sphere cast they attack you
if of course your not already being attacked. (prevent clumping act)
Was wondering how to do (If hit) with sphere cast?

	//------------------------------------------------------------------------------------------------
		if (Target == null) {
			Physics.SphereCast (new Vector3 (0, 0, 0), 2.0f, Vector3.forward, hit2, 300);
				Target = hit2.collider.gameObject;  // How Do I do If hit?
		}
	//------------------------------------------------------------------------------------------------

Actually SphereCast returns a boolean too. If you put your casting in an in if statement it’ll return true if any collider hits it, otherwise it returns false. Another posibility might be checking for null, if not attack whatever it entered.