1
2
3
4
5
6
7
8
9
10
11
12
void PickCube()
{
    if (Input.GetMouseButtonDown(0))
    { 
        RaycastHit hit;
        var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit))
        {    
            Debug.Log(hit.transform.parent);
        }
    }
}
cs


'Unity' 카테고리의 다른 글

Unity Mouse position 가져오기  (0) 2015.03.26
Some are Mac OS X (UNIX) and some are Windows.  (1) 2015.03.14
Unity 간단 팁  (0) 2015.03.13
quad와 plane의 차이  (0) 2015.03.13
Unity 4.6 Text 그림자 만들기  (0) 2015.03.11

+ Recent posts