Skip to content

Instantly share code, notes, and snippets.

@gkagm2
Last active April 25, 2019 16:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gkagm2/8a2a4ca8473da5347c6568733e1f4967 to your computer and use it in GitHub Desktop.
Touch Screen (mobile)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchScreenEx : MonoBehaviour {
//손가락을 화면에 닿은 상태에서 움직이면 물체가 움직인다
void Update () {
if(Input.touchCount > 0 ){
transform.Translate(Input.GetTouch(0).deltaPosition * Time.deltaTime * 1f);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchScreenEx : MonoBehaviour {
void Update () {
//이것은
if(Input.touchCount > 0){
Debug.Log(Input.GetTouch(0).position);
}
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchScreenEx : MonoBehaviour {
void Update () {
//한 손가락을 터치하고 있으면 감지
if(Input.touchCount > 0){
Debug.Log(Input.GetTouch(0).deltaPosition);
}
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchScreenEx : MonoBehaviour {
void Update () {
// 두 손가락을 터치하고 있으면 감지
if(Input.touchCount > 0){
Debug.Log(Input.GetTouch(1).deltaPosition);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment