VS Code
To use TypeScript in a Unity project, it is required to use an IDE (Integrated Development Environment) to write the code in. It is highly recommended to use VS Code because it has Genies tools for autocomplete, debugging, and much more.
Setting Up
Download VS Code
Download the latest version of VS Code here: https://code.visualstudio.com/
Extensions
In VS Code, open the left side Extensions tab. Install the Unity and TypeScript extensions for VS Code.
Tips and Tricks
Reset VS Code
If VS Code is experiencing issues with TypeScript such as not autocompleting or throwing errors for vector operations, then follow these steps:
Here is a step by step to resetting VS Code to correct version:
- Close and reopen VS Code.
- Make sure the VS Code file parent directory is opened at the Unity project folder.
- At the top input field, type
> TypeScript: Select TypeScript Version
. - Select the Workspace option from the dropdown menu.
Debugging
Check out the Debugging with VS Code page for more information.
Autocomplete Lifecycle Events
You can autocomplete lifecycle events when you begin typing the names, like so: