hit.transform.gameObject.layer

RaycastHit2Dのlayerを参照したい。
hit. transform. gameObject. layer
http://docs.unity3d.com/ja/current/ScriptReference/RaycastHit2D.html
公式のページから、RaycastHit2Dは、 transformのプロパティを持っていることわかる。
transformからgameObjectにを参照し、layerにたどり着く。

void CreatEmpty(){
	Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
	RaycastHit2D hit = Physics2D.Raycast(worldPoint,Vector2.zero);
	Vector2 hitPoint;
	if(hit){
        Bounds rect =  hit.collider.bounds;
        if(rect.Contains(worldPoint)){
        	// 
        	if( hit.transform.gameObject.layer == 8){
            	print ("hit!!");
            	hitPoint= hit.point;
				print ("hit.point = "+ hitPoint);
				NowParent = Instantiate(Prefab, hitPoint, Quaternion.identity) as GameObject;
				NowParent.transform.parent = gameObject.transform;
			}
		}
	}
}