if(Input.GetMouseButtonDown(0)) {
Vector3 p = Input.mousePosition;
p.z = 20;
Vector3 pos = Camera.main.ScreenToWorldPoint(p);
Instantiate(obj, pos, Quaternion.identity);
}
if(Input.touchCount >= 1 && Input.GetTouch(0).phase == TouchPhase.Began) {
Vector3 p = Input.GetTouch(0).deltaPosition;
p.z = 20;
Vector3 pos = Camera.main.ScreenToWorldPoint(p);
Instantiate(obj, pos, Quaternion.identity);
}
Unity mouse Drag object/ Touch moved (0) | 2019.01.15 |
---|---|
how to change script editor in Unity (0) | 2019.01.08 |
Unity Drag Camera Movement (0) | 2018.10.25 |
Unity RayCast 사용 ( 마우스 ) code (0) | 2018.10.25 |
Unity Screen rotation Fixed (0) | 2018.10.22 |
Unity Phone Screen Resolution Sizing (0) | 2018.10.22 |