问答详情
源自:3-6 响应用户输入-Unity3D角色控制

Input.GetAxis("Horizontal") ,一直输出为 0

using System.Collections;

using System.Collections.Generic;

using UnityEngine;



public class main : MonoBehaviour {



    // Use this for initialization

    void Start () {

        Debug.Log("y  " + Input.GetAxis("Horizontal"));

//输出 y 0

    }

// Update is called once per frame

void Update () {

}

}



提问者:孙浩飞XF 2018-07-10 21:38

个回答

  • 孙浩飞XF
    2018-07-10 21:39:07

    好吧,看错函数了,应该写在 update里面