VR & AR 개발/Unity 개발

[Unity] Visual Studio Code로 코딩하기

글른 2022. 5. 17. 13:36

Unity에 VSCode script (IDE script)를 통합하는 방법은 지난 글을 참고하시면 됩니다. 

 

[Unity] Visual Studio와 Unity 통합하기

Unity에서 C, C#, Python 등의 native로 개발을 쉽게 하기 위해선 IDE (Integrated Development Evironment)를 사용하게 되는데, 대부분의 경우 Visual Studio를 사용한다. 이 글에서는 이 Visual Studio를 Unity..

hyuna-tech.tistory.com

해당 글은 Unity 공식  document를 참고하여 작성 했습니다. 

 

Code in the default script - Unity Learn

In this tutorial, you’ll: Identify the default script components of a new script Edit a script component in your IDE (Integrated Development Environment). Display a message from a script in the Unity Editor’s Console window.

learn.unity.com

 

이번에는 VS Code에서 본격적인 코딩을 시작하는 첫 단계입니다! Assets 안에 추가된 script를 더블 클릭하면, VSCode가 자동으로 열리고, 우리는 여기에서 코딩을 하면 됩니다!

 

VSCode에서 열린 모습입니다. 

여기서 MonoBehavior는 Unity와 VSCode 간의 naming 싱크가 맞도록 하는 build-in class인 것 같습니다. 그리고 그 아래 startupdate라는 이름의 두 함수가 존재합니다. 

Step 1. Start() 함수 내에 Debug.Log("Hello World");라는 debugging message를 작성합니다.

Step 2. Unity 창에서 Cmd(Ctrl) + Shift + C를 눌러 Console 창을 띄우면, VSCode에서 작성한 debugging message가 출력되는 것을 확인할 수 있습니다.