• 카테고리

    질문 & 답변
  • 세부 분야

    게임 프로그래밍

  • 해결 여부

    미해결

캐릭터가 움직이지 않아요ㅠㅠ

20.07.20 17:17 작성 조회수 145

0

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class PlayerController : MonoBehaviour

{

    // Start is called before the first frame update

    void Start()

    {

        

    }

    // Update is called once per frame

    void Update()

    {

        if (Input.GetKey(KeyCode.W))

            transform.position += new Vector3(0.0f, 0.0f, 1.0f);

        if (Input.GetKey(KeyCode.S))

            transform.position -= new Vector3(0.0f, 0.0f, 1.0f);

        if (Input.GetKey(KeyCode.A))

            transform.position -= new Vector3(1.0f, 0.0f, 0.0f);

        if (Input.GetKey(KeyCode.D))

            transform.position += new Vector3(1.0f, 0.0f, 0.0f);

    }

}

코드 어디가 잘못된걸까요?

답변 2

·

답변을 작성해보세요.

1

안녕하세요!

우선 코드 문제는 아닌 것 같고,
만드신 PlayerController를 실제 Player에 붙이셨는지 확인 바랍니다.
(2:53 보면 PlayerController가 Player 객체에 추가되어 있는 상태입니다)
느낌상 부품을 만들고 실제 조립을 깜빡하신 것 같네요.
그래도 문제가 해결되지 않는다면,
전체 프로젝트를 압축해서 rookiss@naver.com로 보내주시면 살펴보겠습니다.

감사합니다!

0

김수진님의 프로필

김수진

질문자

2020.07.23

늦게 답글 드려 죄송합니다!  말씀해주신대로 했더니 해결되었습니다 감사합니다 :)