方向キーを入力した際、左右の場合はオブジェクトを回転、上の場合は前進させると同時に押した方向キー画面に表示したいのですが、画面への出力がわかりません。
特にエラーメッセージは見当たりません。
C#
1using UnityEngine; 2using System.Collections; 3using UnityEngine.UI; 4 5public class Textup : MonoBehaviour 6{ 7 public Canvas canvas; 8 public Text text; 9 10 public void ChangeEnabled(Text textComponent) 11 { 12 if (Input.GetKeyDown(KeyCode.UpArrow)) 13 { 14 textComponent.enabled = true; 15 } 16 else 17 { 18 textComponent.enabled = false; 19 } 20 } 21} 22 23using System.Collections; 24using System.Collections.Generic; 25using UnityEngine; 26 27public class Player : MonoBehaviour 28{ 29 public Rigidbody rb; 30 31 void Update () 32 { 33 if (Input.GetKeyDown(KeyCode.UpArrow)) 34 { 35 transform.Translate(0, 0, 10); 36 } 37} 38
バージョンはUnity 2017.4.1f1 Personal(64bit)です
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。