Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add auto-complete for common functions like "Start" and "Update"

Monodevelop can auto-complete code, but it can't auto-complete key functions like Start, Update, FixedUpdate, OnCollisionEnter and so on, as such I often misspell the key functions.

Is there a way to add auto-complete or spell-check entries for these common functions?

like image 455
Jonguo Avatar asked May 29 '14 09:05

Jonguo


People also ask

Why is Visual Studio not working with Unity?

Check that Visual Studio is set as your external script editor in Unity using Edit / Preferences / External Tools . Depending on your Unity version: Check that the Visual Studio plugin is installed in Unity. Help / About should display a message like Microsoft Visual Studio Tools for Unity is enabled at the bottom.


2 Answers

While you can't create autocorrect entries in MonoDevelop, you can create Code Snippets (called Code Templates in MonoDevelop).

A code snippet is a chunk of code that is automatically created when you type an id string (e.g. start) and hit tab. It could be a function, a property, a bit of boilerplate you always find yourself writing (e.g. GetComponent calls). It even shows up in the autocorrect list.

Code snippets are quite powerful, and even allow you to tab over boilerplate and change important things like types and variable names easily and quickly.

Simply create a code snippet (MonoDevelop-> Tools -> Options -> Text Editor -> Code Templates-> Add) for each of the items you typically have problems with.

like image 153
Nick Udell Avatar answered Oct 26 '22 22:10

Nick Udell


Well, you can use the Unity Snippets for MonoDevelop for your problem. It has got a lot of useful snippets in it, works really great. When the Code Snippet Code appears, Double Tap TAB key to insert the template.

Image

Download the Unity.template.xml and create a folder called Snippets inside the C:\Users{your_pc_name_here}\AppData\Roaming\MonoDevelop-Unity-5.0 (or in Windows Press Win+R -> %appdata%) and Copy this file to that folder. On Restarting Monodevelop, the code snippets will be working.

like image 35
Monster Brain Avatar answered Oct 26 '22 22:10

Monster Brain