Simple setup guide for Unity Development with VS Code.
This guide Supports languages below.
Created: 2020-06-04
Last updated: 2020-06-05
https://unity3d.com/get-unity/download
Go to Profile > Sign in on the top-right.
Go to Profile > Manage license on the top-right.
Click ACTIVATE NEW LICENSE.
- Choose
License Agreement: Unity Personal - Choose I don't use Unity in a professional capacity.
- Click
DONE.
Go to Installs on the left.
Click ADD.
- Choose
version of Unity: Unity 2019.3.15f1 - Click
NEXT.
Go to Projects on the left.
Click NEW.
- Leave options as default.
- Click
CREATE.
Go to Edit > Preferences.
- Click
External Toolson the left. - Choose
Exteral Script Editor: Visual Studio Code.
Go to Asset Store and search the keyword as VSCode.
Download&Importthis.
Go to Edit > Preferneces.
- Click
VSCodeon the left. - Edit
VS Code Path: C:\Program Files (x86)\Microsoft VS Code\bin\code.cmd - Enable all options listed below.
Enable IntegrationUse Unity DebuggerRevert Script On Unl..Output Messages To ConsoleAlways Write Lauch File
(Optional) If you are interested in dark theme on Unity, see here.
Requires .NET Core SDK.
Check the stuff installed via dotnet command on CMD.
$ dotnet --versionIf you have to install newly, restart Windows would be needed.
https://code.visualstudio.com/Download
Go to View > Extensions.
Install extensions listed below.
[Unity]
Go to Assets > Create > C# Script.
Create with default name(NewBehaviourScript) & open it.
[VSCode]
Copy & paste code lines below to NewBehaviourScript.cs.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
int test = 0;
// Start is called before the first frame update
void Start()
{
Debug.Log("Start()");
}
// Update is called once per frame
void Update()
{
test++;
Debug.Log("Update(): test = "+test);
}
}[Unity]
Choose SampleScene > Main Camera in Hierachy window.
Click Add Component and choose Scripts > New Behaviour Script in Inspector window.
Save. (shortcut: Ctrl+S)
Restart both Unity & VScode.
[VSCode]
Set a breakpoint on a line of Debug.Log("Update(): test = "+test);.
Go to Run > Start Debugging. (shortcut: F5)
[Unity]
Play the scene.
When the code at the breakpoint is executed, the debugger will stop.
Restart would resolve most of problems.
Good luck. 😉
