Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 안드로이드스튜디오
- unityAR
- 게임개발
- Java
- unorderedmap
- ARface
- semaphore
- StartActivityForResult
- 스핀락
- NotFoundException: String resource ID #0x0
- 뮤텍스
- photon
- dependencyResilutionManagement
- 포톤
- list
- map
- mutex
- C++
- 지크슈
- 광유다
- 세마포
- Unity
- Vector
- 동기화
- registerForActivityResult
- unorderedset
- 유니티
- SpinLock
- 유니티슈팅게임
- 바이너리세마포
Archives
- Today
- Total
와와
[절대강좌유니티] 14. Input System 본문
14. Input System
1) Imput System의 구조
Action : 게임 내의 행동, 동작 ( ex. 이동, 회전, 공격, 점프 )
BInding : Action을 실제 물리적인 입력장치와 매핑하는 것 ( 점프 - 키보드 스페이스 키 )
Action Map : 여러 Action의 그룹 ( ex. UI, Player )
2) Imput System 패키지 설치
패키지 매니저 > Unity Registry > Input System 설치
3) Input Actions 에셋

4) Player Input 컴포넌트
캐릭터에 컴포넌트 추가 후 Input Actions 에셋 바인딩
- Behavior - Send Messages 옵션
: Input Actions에서 설정한 액션을 SendMessage 함수를 이용하여 호출
#pragma warning disable IDE0051
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerCtrl : MonoBehaviour
{
void OnMove(InputValue value)
{
Vector2 dir = value.Get<Vector2>();
Debug.Log($"Move = ({dir.x},{dir.y})");
}
void OnAttack()
{
Debug.Log("Attack");
}
}
2. Behavior - Invoke Unity Events 옵션
3. Behavior - Invoke C Sharp Events 옵션