4

在 Mac 下配置 Visual Studio Code 为 Unity 代码编辑器

 2 years ago
source link: http://dualface.github.io/2016/12/21/unity-vscode/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

在 Mac 下配置 Visual Studio Code 为 Unity 代码编辑器

0 Comments

Unity 虽然附带了一个 MonoDevelop 作为代码编辑器,但是这个编辑器并不好用。经过半天折腾,把 Visual Studio Code 打造成了 Unity 的代码编辑器,用起来倍儿爽!

[2017-01-09 更新]

首先,下载并安装 Visual Studio Code(后文简称 VSC)和 Mono Framework:

启动 VSC 后,从左侧选择 Extensions 标签,安装下列扩展:

  • C#: 对 C# 代码和工程提供全面支持。
  • Debugger for Unity: 用来调试 Unity 工程的,如果不用调试功能,这个扩展不用装。
  • Unity Tools: 这个扩展是可选的。但其中有一个功能相当方便。选中关键字按 CMD+' 键就可以在线查找 Unity 文档。
  • Unity Snippets: 这个扩展是可选的。可以快速创建 StartUpdate 等常用方法的片段。

安装完所有扩展,需要重启 VSC。

安装完成上述插件后,我们还需要在 Unity 中安装一个 VSC 插件:

  • 启动 Unity 打开工程
  • 从 Assets Store 搜索 VSCode (http://u3d.as/jmM),将这个插件导入到工程中
  • 打开 Unity 首选项,选中 VSCode 标签后,选中 Enable IntegrationUse Unity Debugger 选项
  • 选择菜单 Assets / Open C# Project In Code 即可在 VSC 中打开 Unity 工程

如何通过 VSC 调试 Unity 工程:

  • 在 VSC 中选中 Debugger 标签
  • 如果 launch.json 文件已经存在,需要先删除
  • 点击项目顶部的齿轮按钮,选择 “Unity Debugger” 添加 launch.json 文件到项目中
  • 从 Debugger 列表中选择 “Unity Editor”
  • 在源代码编辑窗口中,点击左侧行号设置断点
  • 点击 Start Debugging 箭头按钮
  • 切换到 Unity,点击运行游戏
  • 切换回 VSCode,即可在断点处进行调试

-EOF-

分享到

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK