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 |
29 | 30 |
Tags
- NotFoundException: String resource ID #0x0
- 스핀락
- 뮤텍스
- unorderedset
- map
- 세마포
- photon
- 유니티
- unorderedmap
- 안드로이드스튜디오
- 지크슈
- mutex
- SpinLock
- 광유다
- semaphore
- list
- unityAR
- 게임개발
- 바이너리세마포
- dependencyResilutionManagement
- Unity
- Java
- registerForActivityResult
- C++
- Vector
- StartActivityForResult
- 유니티슈팅게임
- 포톤
- 동기화
- ARface
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 옵션