I just found a neat built-in feature inside MonoDevelop :
Whenever you put the word “TODO” (case sensitive) in a comment, it highlights the word in a flashy color so that you can see it instantly when browsing your code.
Can be very helpful to find an old Todo thing !
Considering it’s kind of cool, and totally unnecessary from MonoDevelop devs to implement that, I guess there are other built-in tricks like that.
“Navigate to” - just start typing the name of ANY class or method name or variable name in your project, and it’ll take you right there. Super handy, I use this constantly. Bind it to a shortcut that’s easy for you to do with one hand (CTRL+Shift+R for me).
“Dynamic Abbrev” - bound to Ctrl+/ for me. Type the first character or two of ANYTHING you could possibly want to write (ex. variable names, method names), it will fill in the rest, if it doesn’t choose the right one, keep hitting the shortcut until it does. It goes in historical order of the most recent things you typed. It’s like autocompletion but super fast because it’s not doing any complex calculations, it’s just looking through things that have been typed in the past (or something like that). Seriously this will save you from typing TONS of stuff, I use this more than any other shortcut.
I like to do a lot of scripting in UnityScript but find that monodevelop sometimes isn’t as intuitive when comparing to use in C#, NotePad ++ is actually pretty good for it though…
Hey guys! I know this thread is kind of old now but I love the idea of sharing Tips and Tricks! Props to Philipp_S for writing up a blog post, I hope to do the same!
Here’s one of my favorites:
Type ‘for’ and then push tab twice, and it’ll make a for loop for you! Push tab to edit some of the fields if need be (it will try to auto-fill things as best as it can). Push Enter to set the cursor inside the loop so you can start typing your implementation. This works for ‘foreach’ as well. Very handy for quick coding.
Anybody know what this is called and how we can customise them? Cause I find it fascinating
Cheers all
EDIT:
They’re called Code Templates. You can find them in MonoDevelop > Preferences ( CMD + , )
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
[CustomEditor(typeof($component$))]
[CanEditMultipleObjects]
public class $component$Inspector : Editor {
public override void OnInspectorGUI() {
serializedObject.Update();
var obj = target as $component$;
DrawDefaultInspector();
serializedObject.ApplyModifiedProperties ();
}
}
Template to create a singleton
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class $c$ : MonoBehaviour {
private static $c$ ins;
public static $c$ Get() {
if (ins == null) {
ins = GameObject.FindObjectOfType<$c$>();
if (ins == null) {
var obj = new GameObject("$c$");
ins = obj.AddComponent<$c$>();
}
}
return ins;
}
}
Question:
There is any shortcut to navigate inside the file? For example, go to method Awake in current class? Something like eclipse IDE is ctrl+o.
In MonoDevelop 4 press ‘Ctrl+,’ and you can search for anything (types, members, commands, and even files) by name or only part of the name! This is the most useful thing I’ve found so far in MD and one of the rare things that actually work and it’s fast.