Unity Development Environment Setup Guide

Issues with git credentials? Scene merging? Intellisense? Setting up the Unity Debugger? This guide should help you with all of that. It will not teach you how to use these tools, but rather how to set them up. I've spent days trying to figure out how to set up my environment properly, so hopefully this guide will save you some time.

Note that this was written while setting up a fresh PC for development. Some necessary steps might be missing or you might have already done some of the steps. Use this guide as a way of checking what you might have missed. Some things might also have changed since the writing of this guide (April of 2023).

  1. Install git: https://git-scm.com/downloads
  2. Install sourcetree: https://www.sourcetreeapp.com/ When installing, you will need to connect a bitbucket account. Create one if you don't have it. Afterwards, also connect your github account to Sourcetree.
  3. Install git credential manager (you might need to find newest release if link is outdated): https://github.com/git-ecosystem/git-credential-manager/releases/tag/v2.0.935
  4. Follow this guide to fix issue with GitCredentialHelper showing up over and over: https://community.atlassian.com/t5/Sourcetree-questions/I-always-get-a-popup-credential-helper-selector-asking-me-to/qaq-p/1465880
  5. Install Unity hub
  6. Install Unity version according to the project you are working on. A good way to do this is to try to open a cloned Unity project. Unity hub should then prompt you to install the correct Unity version for that project.
  7. No need to install Visual Studio when prompted, we will install VS Code later instead. Unlike Visual Studio, VSCode is completely free to use. Of course, you can use Visual Studio instead if you prefer.
  8. Setup unity smart merge to merge prefab and scene files automatically (it only takes 5 minutes!): https://docs.unity3d.com/Manual/SmartMerge.html
  9. Install VS Code (if you dont write any code at all you can skip VS code setup). This is a nice video which takes you through the next few steps: https://www.youtube.com/watch?v=ihVAKiJdd40
  10. I also found this video for MAC (not tested at all though): https://www.youtube.com/watch?v=3GVGyooZ8jk
  11. At some point VS Code prompts to install Microsoft .Net SDK 7.0. Make sure it is installed if it didn't install automatically.
  12. VSCode extensions to install:
    1. C#
    2. Unity Tools
    3. Debugger for Unity (Included in Unity Tools, it will be shown as deprecated, but it still works). This extension helps with setting up the debugger for Unity.
    4. Git Lens - Git supercharged
  13. I also recommend these extensions:
    1. Github Copilot (it's free for students!)
    2. Bookmarks
    3. Code Spell Checker
    4. HLSL Tools (for writing shaders)
  14. Open your Unity project
  15. Go to Edit > Preferences and search for "editor". Set default editor to VS Code.
  16. Setting up Debugging. Normally, installing the Debugger for Unity extension should be enough. Switch to the debug tab on the left, and press create a launch.json file. The dropdown menu that appears should contain the Unity Debugger. Sometimes it doesn't, in which case you need to give it some time :D Try restarting VS Code and give it sometime to run in the background. For me, the button just appeared after doing so. If it doesn't appear after 10-ish minutes, start searching for other solutions. This might help: https://answers.unity.com/questions/1815046/how-to-attach-unity-debugger-in-vs-code.html Pressing the button should create the file, and you should now be able to use debugging for your project.