パドルが左右に動くゲームをドットインストールを見ながら作っています。
左右に動く速さをインスペクタから変えられるようにpublic float speedにしたのですが、インスペクタのスピードの数字の変更ができません。
ためしたこと
コードがあっているかは何回か確認しました。
手順が間違っていないかは何度も確認しましたがあっているようです。
コードに何か問題があるのでしょうか?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PaddleScript : MonoBehaviour
{
//private float speed;
public float speed;
// Start is called before the first frame update void Start() { //speed = 5f; } // Update is called once per frame void Update() { transform.position += new Vector3(Input.GetAxis("Horizontal") *Time.deltaTime * speed, 0f, 0f); //Debug.Log(transform.position.x); }
}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。