Question by
MrCrumbl3d · Jan 05, 2018 at 05:01 PM ·
touchmetadefaultmoderationjava to c#
Convert this to C# please.....
var bullet : Transform;
function Update () {
if (Input.GetTouch(0).phase == TouchPhase.Began) {
var touchPos = Input.GetTouch (0).position;
var createPos = Camera.main.ScreenToWorldPoint (Vector3(touchPos.x,touchPos.y, 10));
Instantiate (bullet, Vector3(createPos.x, createPos.y, 0), Quaternion.identity);
}
}
Comment
Answer by Dragate · Jan 05, 2018 at 05:19 PM
public Transform bullet;
void Update () {
if (Input.GetTouch(0).phase == TouchPhase.Began) {
Vector2 touchPos = Input.GetTouch (0).position;
Vector3 createPos = Camera.main.ScreenToWorldPoint (new Vector3(touchPos.x,touchPos.y, 10));
Instantiate (bullet, new Vector3(createPos.x, createPos.y, 0), Quaternion.identity);
}
}