Vector3 변수명 = Input.mousePosition;
현재 마우스 위치를 읽음

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class App : MonoBehaviour
{
  // public Controler Controler;
    
    void Start()
    {
    }

    private void Update()
    {
       Vector3 f = Input.mousePosition;
        Debug.Log($"마우스 위치: {f}");
    }
}

 

bool i변수명 = Input.GetKeyDown(KeyCode.키);
키를 누르고 있는 동안~

bool i변수명 = Input.GetKey(KeyCode.키);
키를 누르면~

float 변수명 = Input.GetAxis("InputManager 키 이름“);
0.0000…f라 자연스러운 이동을 원할 때 사용

     float 변수명 = Input.GetAxis(“Horizontal“);
     키보드 화살표 가로 방향 Left, Right 누르면 -1.0f ~ +1.0
     안누르면 0

     float 변수명 = Input.GetAxis("Vertical");
    키보드 화살표 위아래 방향 Up, Down 누르면 -1.0f ~ +1.0f
    안누르면 0

KeyCode(enum)
마우스와 키보드 등 장치의 이름이 미리 정의되어있음
Edit - Preferences -InputManaguer  

https://docs.unity3d.com/ScriptReference/KeyCode.html

 

Unity - Scripting API: KeyCode

Description Key codes returned by Event.keyCode. These map directly to a physical key on the keyboard. If "Use Physical Keys" is enabled in Input Manager settings, these map directly to a physical key on the keyboard. If "Use Physical Keys" is disabled the

docs.unity3d.com


Space, Return
RightArrow, LeftArrow
q,w,e,r
a,s,d
LeftShift
Mouse0, Mouse1,

+ Recent posts