unity初心者です。
unityのTouchScriptでタッチした場所の位置を取得したいです。
2dのシューティングをスマホ向けに作成中で、タッチした位置にボムを置くみたいな仕様を実装したいです。TouchScriptを使用しているのは、他にもフリック操作を実装したり、マウスクリックをタップとして認識してくれるのでデバッグをしやすいからです。ですので、できればInputは使いたくないです。
こちらの記事の「タップされた位置を知る」の部分のスクリプトを実装してみたのですが、
Assets/Scripts/Player/SubBulletFire1.cs(32,9): error CS0246: The type or namespace name `TouchHit' could not be found. Are you missing an assembly reference?
とエラーがでます。以下スクリプトです。TouchScriptに詳しい方、何卒ご教授願います。
using
1using TouchScript.Gestures; 2using TouchScript.Gestures.TransformGestures; 3using UnityEngine; 4 5public class SubBulletFire1 : MonoBehaviour 6{ 7 public TapGesture tapGesture; 8 9 10 public GameObject subBullet1; 11 12 private void OnEnable() 13 { 14 tapGesture.Tapped += OnTapped; 15 } 16 17 private void OnDisable() 18 { 19 tapGesture.Tapped -= OnTapped; 20 } 21 22 // Use this for initialization 23 void Start() 24 { 25 } 26 27 28 private void OnTapped(object sender, EventArgs e) 29 { 30 var gesture = sender as TapGesture; 31 TouchHit hit; 32 33 gesture.GetTargetHitResult(out hit); 34 35 Debug.Log(hit.Point); 36 } 37} 38
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/12 06:22