-5
마우스 단추를 누를 때 다른 개체에 개체를 첨부하려면 어디에서 C# (unity3d)의 스크립트를 찾을 수 있습니까?다른 개체에 개체 부착
많은 스크립트를 사용하려고했지만 하나는 작동하지 않습니다.
마우스 단추를 누를 때 다른 개체에 개체를 첨부하려면 어디에서 C# (unity3d)의 스크립트를 찾을 수 있습니까?다른 개체에 개체 부착
많은 스크립트를 사용하려고했지만 하나는 작동하지 않습니다.
if (Input.GetMouseButtonDown(0)) {
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit))
if (hit.collider == this.gameobject) // this can be checked on parent or child, your call
this.transform.parent = yourParentObject;
}
개체를 부모 위치로 이동하려면 this.gameobject.transform.position = yourParentObject.transform.position –