Unity Vscode



安装完成后,用VSCode打开Unity工程,当输入关键词代码时,就会出现自动提示。 image 如果是新建的一个Unity工程,打开C#脚本后输入关键词发现并没提示或者补全功能,这个问题也好解决,就是 缺少.sln 文件,解决方法如下:. 我對 Unity 預設使用的 MonoDevelop 編輯器印象實在不怎麼好 推薦大家改用Visual Studio Code 編輯器,因為它的速度快、插件 齊全。 所以就決定特定寫篇 教學文 ,幫助大家改換用VS code 作為Unity 預設編輯器囉。 2018.1.

Create Unity classes and methods easily.

Features

All Unity code snippets you need. This extension intends to be the complete collection of Unity snippets for Visual Studio Code.

Code
  • VSCode do not understand Unity, and when you try to follow something into the package, it ask the C# project file and found that it is a dll, and so it dig into the dll (generated from asmdef) instead of an actual package source code that is also available somewhere else.
  • Adds support for choosing extensions to be opened with VSCode. This can be done through the GUI in Preferences. Avoids opening all extensions after the change in core unity. 1.0.7 - 2019-05-15. Fix various OSX specific issues. Generate project on load if they are not generated. Fix path recognition. 1.0.6 - 2019-04-30.

It takes advantage of latest Visual Studio Code snippets features to create the code faster for you.

MonoBehaviour

Unity Vscode Intellisense

Create game classes like MonoBehaviours, NetworkBehaviours and StateMachineBehaviours easily. Also create common methods like Start(), Update() or OnTriggerEnter2D() and log calls.

Editor

Create an Editor classes like Editor, EditorWindow and PropertyDrawer as easy as it can be.

ScriptableObject

You never remember the property that goes with the ScriptableObject to create it via Unity create menu? Not a problem.

Instalation

As in any Visual Studio Code Extension you have several options to install:

  • Enter the Visual Studio Code Marketplace, search for Unity Code Snippets (or enter directly on the extension page) and click on Install button.
  • Inside Visual Studio Code, enter in the Extensios panel, search for Unity Code Snippets and click on Install button
  • Run the following command in the Command Palette:
Unity

All the snippets

Debugger

Unity Vs Code

Start typing the names to create the corresponding snippets.

  • Game classes:

    • MonoBehaviour
    • StateMachineBehaviour
    • NetworkBehaviour
    • ScriptableObject
  • Editor Classes:

    • Editor
    • Editor with Reorderable List(NEW)
    • EditorWindow
    • PropertyDrawer
    • ScriptableWizard
  • MonoBehaviour Methods:

    • Awake()
    • FixedUpdate()
    • LateUpdate()
    • OnAnimatorIK()
    • OnAnimatorMove()
    • OnApplicationFocus()
    • OnApplicationPause()
    • OnApplicationQuit()
    • OnAudioFilterRead()
    • OnBecameInvisible()
    • OnBecameVisible()
    • OnCollisionEnter()
    • OnCollisionEnter2D()
    • OnCollisionExit()
    • OnCollisionExit2D()
    • OnCollisionStay()
    • OnCollisionStay2D()
    • OnConnectedToServer()
    • OnControllerColliderHit()
    • OnDestroy()
    • OnDisable()
    • OnDisconnectedFromServer()
    • OnDrawGizmos()
    • OnDrawGizmosSelected()
    • OnEnable()
    • OnFailedToConnect()
    • OnFailedToConnectToMasterServer()
    • OnGUI()
    • OnJointBreak()
    • OnJointBreak2D()
    • OnMasterServerEvent()
    • OnMouseDown()
    • OnMouseDrag()
    • OnMouseEnter()
    • OnMouseExit()
    • OnMouseOver()
    • OnMouseUp()
    • OnMouseUpAsButton()
    • OnNetworkInstantiate()
    • OnParticleCollision()
    • OnParticleTrigger()
    • OnPlayerConnected()
    • OnPlayerDisconnected()
    • OnPostRender()
    • OnPreCull()
    • OnPreRender()
    • OnRenderImage()
    • OnRenderObject()
    • OnSerializeNetworkView()
    • OnServerInitialized()
    • OnTransformChildrenChanged()
    • OnTransformParentChanged()
    • OnTriggerEnter()
    • OnTriggerEnter2D()
    • OnTriggerExit()
    • OnTriggerExit2D()
    • OnTriggerStay()
    • OnTriggerStay2D()
    • OnValidate()
    • OnWillRenderObject()
    • Reset()
    • Start()
    • Update()
  • Some useful code snippets:

    • Debug.Log() (type log)
    • Debug.LogError() (type logerror)
    • Debug.LogWarning() (type logwarning)
    • Debug.LogException() (type logexception)

Unity Vscode Vs Visual Studio

If you have any suggestions, open an issue in the Github project page and I'll add it as soon as I can :).

Unity Vscode Intellisense Not Working

If you like the color theme of the previews, you can download it here: Base16 Ocean Dark Extended Theme.

Visual Studio Code For Unity

Thanks you for downloading this extension.