Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

MonoDevelop secret tips :

Discussion in 'Formats & External Tools' started by n0mad, Sep 8, 2011.

  1. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    Hello,

    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.

    Do you know some ?
     
  2. ahmetDP_1

    ahmetDP_1

    Joined:
    Sep 23, 2010
    Posts:
    113
    You know it also pops up in a list inside TaskList pad (View -> Pads -> TaskList)
     
  3. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    Brilliant ! Thanks :)
     
  4. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Ehe, probably by now you will have got them, but just in case:
    - FIXME is the same as TODO, but is highlighted in red.
    - In MonoDevelop "Tools > Options > Task List" you can add more tokens (special words) and set their importance.
     
  5. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    Didn't know the FIXME one, thanks :p
     
  6. Philipp_S

    Philipp_S

    Joined:
    Jul 18, 2012
    Posts:
    16
    digzou likes this.
  7. pjezek

    pjezek

    Joined:
    Jun 10, 2009
    Posts:
    18
    Thanks for that list, very helpfull :)
     
  8. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    664
    Wow. I always write Todo´s in my scripts and wished that something like that exists XD
    I use C# in Visual Studio but it works there too!
     
  9. MattRix

    MattRix

    Joined:
    Aug 23, 2011
    Posts:
    121
    The two uncommon commands that I use a LOT are:

    "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.
     
  10. Matthew Scott

    Matthew Scott

    Joined:
    Jan 16, 2013
    Posts:
    33
    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...
     
    Last edited: Dec 10, 2013
  11. EMOTION-THEORY

    EMOTION-THEORY

    Joined:
    Jul 16, 2013
    Posts:
    83
    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 + , )

    $Screen Shot 2014-03-18 at 2.13.11 pm.png

    There are heaps! Using them could be a huge performance booster.
     
    Last edited: Mar 18, 2014
  12. Sisso

    Sisso

    Joined:
    Sep 29, 2009
    Posts:
    196
    Adding stuff.... Theses templates really help me.

    Template to create a custom inspector

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5.  
    6. [CustomEditor(typeof($component$))]
    7. [CanEditMultipleObjects]
    8. public class $component$Inspector : Editor {
    9.     public override void OnInspectorGUI() {
    10.         serializedObject.Update();
    11.         var obj = target as $component$;
    12.         DrawDefaultInspector();
    13.         serializedObject.ApplyModifiedProperties ();
    14.     }
    15. }
    Template to create a singleton

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class $c$ : MonoBehaviour {
    6.     private static $c$ ins;
    7.  
    8.     public static $c$ Get() {
    9.         if (ins == null) {
    10.             ins = GameObject.FindObjectOfType<$c$>();
    11.             if (ins == null) {
    12.                 var obj = new GameObject("$c$");
    13.                 ins = obj.AddComponent<$c$>();
    14.             }
    15.         }
    16.  
    17.         return ins;
    18.     }
    19. }
    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.
     
  13. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,786
    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.
     
  14. Sisso

    Sisso

    Joined:
    Sep 29, 2009
    Posts:
    196
    I didn't see utility for method search, try to search for "Awake", Will show Awake from a lot of classes, but not the open one.
     
  15. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,786
    Might be easier to just use the code navigation bar:
    $NavBarMD.png
     
    coutlass-supreme likes this.