https://github.com/JohnBaracuda/com.baracuda.runtime-monitoring?tab=readme-ov-file
using Baracuda.Monitoring; this.StartMonitoring()InputAction은 입력을 정의한 개별 명령 단위임.
예:
"Move"라는 이름의 InputAction 하나 → WASD or Gamepad 스틱을 통해 Vector2 값을 받음 "Jump"라는 InputAction → Spacebar를 누르면 이벤트 발생
InputAction= "입력 이름 + 어떤 키를 쓸지 + 어떤 타입인지" 다 정의한 객체
.inputactions 파일 = InputActionAsset
→ 여러 개의 InputAction들을 그룹으로 묶은 것
→ PlayerAction, UIAction, GameplayAction 같은 Action Map으로 분류됨
즉:
InputActionAsset
├── ActionMap: "Player"
│ ├── Action: "Move" (2D Vector)
│ ├── Action: "Jump" (Button)
.inputactions 파일에 있는 "Move" 같은 액션을 Script에서 참조할 수 있게 만든 ScriptableObjectPlayerInput 컴포넌트는 다음을 자동으로 해줌:
playerInput.actions = InputActionAsset
playerInput.actions.FindActionMap("Player").Enable()
PlayerActionMap["Move"].Enable();
PlayerActionMap["Jump"].Enable();
public class PlayerMove : MonoBehaviour
{
[SerializeField] float moveSpeed;
[SerializeField] InputActionReference inputAction;
CharacterController cc;
void Start()
{
cc = GetComponent<CharacterController>();
}
void Update()
{
Vector2 moveInput = inputAction.action.ReadValue<Vector2>();
Vector3 moveDirection = new Vector3(moveInput.x, 0, moveInput.y).normalized;
cc.Move(moveDirection * moveSpeed * Time.deltaTime);
}
}
input system에는 누르고 있는 이벤트 없음. update()는 항상 돌려야 함.
isGrounded는 안정적이지 않다고 함
https://www.youtube.com/watch?v=EubjobNVJdM&list=PLxI8V1bns4ExV7K6DIrP8BByNSKDCRivo
public void UploadMesh(bool sharedVertices = false)
{
mesh.SetVertices(vertices);
mesh.SetTriangles(triangles, 0, false);
mesh.SetUVs(0, UVs);
mesh.Optimize();
mesh.RecalculateNormals();
mesh.RecalculateBounds();
mesh.UploadMeshData(false);
}
mesh.SetVertices(vertices)
vertices 리스트에 저장된 모든 정점(vertex) 데이터를 mesh 객체에 설정합니다.mesh.SetTriangles(triangles, 0, false)
triangles)을 메시에 설정합니다.0은 서브메시 인덱스(submesh index)를 의미합니다. 여기서는 첫 번째 서브메시를 사용합니다.false는 삼각형 배열을 읽기 전용으로 유지하지 않겠다는 뜻입니다.mesh.SetUVs(0, UVs)
UVs)를 메시에 설정합니다.0은 첫 번째 UV 채널을 사용한다는 의미입니다.mesh.Optimize()
MeshUtility.Optimize를 사용하도록 권장합니다.mesh.RecalculateNormals()
mesh.RecalculateBounds()
mesh.UploadMeshData(false)
false는 업로드 후에도 CPU 메모리 상에 데이터를 유지하겠다는 의미입니다.true를 주면 CPU 메모리에서 데이터를 해제하여 메모리를 절약할 수 있으나, 이후 메시 수정이 불가능해집니다.SetVertices까지만 하면 "어떤 점들이 어디에 있다"는 정보만 메시한테 주는 거다.
하지만 렌더링이 되려면 점만 있어서는 안 된다. 컴퓨터는 "이 점들을 어떻게 이어서 면(face)을 만들고, 빛은 어떻게 반사되고, 물체는 공간 안에서 어디까지 차지하는지"를 알아야 한다.
왜 SetTriangles를 해야 하나?
왜 SetUVs를 해야 하나?
왜 Optimize를 해야 하나?
왜 RecalculateNormals를 해야 하나?
왜 RecalculateBounds를 해야 하나?
왜 UploadMeshData를 해야 하나?

