Last active
April 25, 2019 16:01
-
-
Save gkagm2/8a2a4ca8473da5347c6568733e1f4967 to your computer and use it in GitHub Desktop.
Touch Screen (mobile)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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