using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class inputmoov : MonoBehaviour
{
public float speed = 3f;//インスペクターで動くスピードを帰れる・
void Start()
{
}
void Update()
{
float moveX = Input.GetAxis("Horizontal");//⇦⇨キーの入力
float moveY = Input.GetAxis("Vertical");//↑↓の入力
moveX *= Time.deltaTime * speed;
moveY *= Time.deltaTime * speed;
transform.position += new Vector3(moveX, 0, moveY);//動かしたい方向の軸に先程の変数を入れる
}
}
このスクリプトを動かしたいオブジェクトにアタッチ。
終了。