When the unity of the ray tests may be needed to set the desired level, it must be added distance! ! !
// a click from the main camera screen to point ray
Ray ray = Camera.Main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
// returns information about a ray emission (To set the level required for detection, distance must be added !!!)
// CanRay LayerMask layer is defined as unable to manually add selection, the code
// int CanRay=1 << 10 ;
/*
<< 1 10 10 opens the first layer.
~ (1 << 10) of layers other than the opening 10.
~ (1 << 0) to open all of the layers.
(1 << 10) | Open layers 10 and 8 (1 << 8).
*/
IF (Physics.Raycast (ray, OUT HIT, 1000, CanRay))
{
IF (hit.transform.gameObject.name == "renwu")
{
Print ( "hit-ray detector moving character");
}
// When the parent-child objects have a collision, a sub For detection object, a parent object hierarchy need to close, or to open only the sub-object hierarchy
// To obtain sub-objects but information required hit.collider.name (name), when used as hit.transform.name, it returns the name of the parent object
}