Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
April 2, 2020
arrowPress Releases







If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

New IDE for Unity - why switch now?

by Jan Mysior on 07/30/18 11:08:00 am

1 comments Share on Twitter    RSS

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

Disclaimer 1: I am not employed at JetBrains or Microsoft nor was I incentivized in any way to write this article.

Disclaimer 2: This is not an attempt at a comprehensive comparison of all available alternatives – simply a subjective description of my experience with Visual Studio for Mac and JetBrains Rider.


I’ve been using MonoDevelop from the very beginning of my adventure with Unity. I’ve used it to code (and mess up too - see the side note at the end) quite a few projects.

In the peak of my relationship with MonoDevelop (I call it a relationship because there were days when I spent much more time with it than with my wife...) a colleague told me about JetBrains Rider for Unity (back then it was still free), but I felt MonoDevelop did not slow me down so I said… “meh” and remained loyal.

Then, many projects later, came January of 2018 and Unity officially announced dropping future support for MonoDevelop.

Speechless at first... I decided was time to put the tip of my pinky a few centimeters outside the comfort zone. I installed Visual Studio (for Mac) and used it for a few months.

And… I liked it very much!

Well, it needs some manual tweaking to work ok with Unity (like this ProjectFileHook to suppress the constant CS0649 warning) and I had to reprogram some muscle memory because of how different the code completion works. But many code inspections, intelligent variable naming proposals and Unity messages in Intellisense (no more copy-pasting of that OnCollisionEnter() from Unity docs!) made me put Visual Studio in front of MonoDevelop on my list within just a few hours.

After becoming almost a pro in going out of the comfort zone (“almost” being the keyword here), I was ready to try JetBrains Rider (there is 30 day free evaluation) to see if it’s worth the price tag.

A few days later Rider became my number one choice for IDE. And here is why:

Automatic inserts of “using” statements

If you’re using MonoDevelop the following will sound familiar: You want to reference Image or TextMeshProUGUI classes and your autocomplete does not cooperate with you. You suddenly remember you need to write “using UnityEngine.UI” or “using TMPro” at the top (import assemblies).

In Rider you can forget about all that hassle. Autocomplete works even for non-imported assemblies and when you hit Enter, Rider automatically inserts the “using” statements into the appropriate place in your file. Bam!

Rename a class/file without breaking the .meta files in Unity

I’m a maniac when it comes to naming so Ctrl+R is one of the most common shortcuts I use. If you rename a class that derives from MonoBehaviour from within the IDE you usually break your project in Unity (the .meta files don’t get updated and as a result the “referenced script is missing”). This always forced me to rename the file in Unity Editor first and only afterwards rename the class in IDE.

Renaming a class in Rider updates the .meta files in Unity accordingly. Nothing gets broken!

Saving a file in Rider triggers pre-compilation in Unity

Normally (at least on Mac) Unity makes its own pre-compilation only when you focus on Unity Editor window. This means there is around 10 second of lag between saving the file in the IDE and playing the scene back in Unity. 

Rider notifies Unity when saving a file so Unity does the pre-compilation even when not focused. If you use multi-monitor setup (and you really should!) this means you can see Unity generated errors and warnings even while still working on a file in IDE. In many cases it also means the 10 seconds lag is gone allowing you to iterate (coding -> playtesting -> coding) faster.

The power of Alt+Enter (ReSharper)

Well this one is super important, but naming all the cool automatic refactorings the Alt+Enter combo can do for you is impossible – there are just so many. My advice is – try the evaluation period and see for yourself.

Rider teaches me to be a better coder

ReSharper and code analysis has taught me so many code tricks. Like:

  • That I can write the same thing in a shorter/cleaner way
  • That many castings, ToString() calls or parenthesis I used were redundant
  • That many fields/properties in my code can be made private or even readonly
  • That some of my methods can be made static

You can always navigate to the docs to see “Why is Rider suggesting this” and there is a very neatly written article for every single code inspection. It’s like having a more experienced buddy right there at your side at all times showing you some neat tricks and explaining them.

And a few smaller (but oh so sweet) features:

Automatic string concatenation in the next line

Let’s say you are writing a rather long tooltip description and you want it to have multiple lines in your code. Rider knows when you are writing a string so you just hit Enter and it will automatically add the "+" and additional quotation marks.

“Serialized Property” renaming

I like defining getters and setters, but I also like tweaking starting values from Unity inspectors. So I often use this kind of construct:

[SerializeField] private float _maxHealth;
public float MaxHealth { get { return _maxHealth; } }

Side note on SerializeField attribute

In case you don’t know – marking a private field with the [SerializeField] attribute will tell Unity to serialize it. This also means it will show up and be tweakable from the Unity inspector. It’s safer to use a serialized private field than a public field. And if you need the class member to also be public, you can use the construct above (I even made a code snippet out of it).


So normally when I want to rename the field to say “_maxPlayerHealth” I would do that and, for consistency (read “calming my inner crazy person”), I would have to manually rename the public property too.

Rider knows these two are closely connected, so when renaming one it automatically renames the other accordingly.

It’s much easier to tweak settings in your color scheme

Let’s say you don’t like a color of some group of expressions in your color scheme. In MonoDevelop and Visual Studio you have to manually figure out which setting of your color scheme is responsible for the undesired effect. That sometimes is next to impossible.

In Rider you can assign a shortcut to a function called “Jump to Colors and Fonts”. This will jump to the exact color setting of the expression you caret is over.


Rider is not without a few cons too:

  1. The startup time is quite long (but afterwards opening a new file is much faster than in MonoDeveloped and Visual Studio).
  2. On some (difficult to repro) occasions the autocomplete lags so much it needs a full program restart.
  3. You cannot tweak the theme color of the preprocessor directives (I use “#if UNITY_EDITOR” quite a lot) and the color of those is inherited from normal keywords and text. This makes code with many preprocessor directives unreadable – Visual Studio has that done much better.
  4. A Rider plugin must be installed in your Unity project folder (it’s installed automatically) to enable all the cool features. This clutters your project a bit and someone on your team not using Rider might get confused.

 

There are also a few other things Visual Studio does better:

  1. Autocomplete in VS also works for #pragma expressions (eg. #pragma warning disable).
  2. The keywords “private” and “this” have a dimmed color by default. I got very used to this when using VS and missed this feature in Rider.

 

And, to be a bit more comprehensive, a few bugs I've found in Visual Studio (for Mac):

  1. Autocomplete does not work in some weird situations (for example when using a code snippet for a foreach loop!)
  2. Imported color themes just don’t work. No matter how I tried, there was always something broken with the imported color theme.
  3. The caret gets invisible quite often, and the only way to fix this is closing and reopening the file.

Conclusion

MonoDevelop – my old chap… You were there for me when I started to learn Unity. I had so much fun with you. You were also there to witness the dark ages of my coding (see side note below)… Now, I’m sorry, but its time for you to go...


Side note on newbie programing

Well, it’s kind of embarrassing but our quite successful game Them Bombs (think Keep Talking and Nobody Explodes on mobile and you’re spot on) was written without using a single inheritance… and no – it’s not a “composition over inheritance” conscious architecture decision – it’s a “no idea what inheritance is” rookie sort-of decision (I wrote Them Bombs after learning to code from zero for only 5 months - bad idea).​

Still the game is a big success for us with average rating of 4.7 on GooglePlay (over 7500 ratings) and a crash rate of 0.27%. But that also means I have to occasionally get back to that code garbage (created by me from the past) to add new features or fix bugs… yuck!


Anyway, if you’re still clinging to MonoDevelop (which means you are like me in the past) I suggest you take a leap and try either JetBrains Rider or Visual Studio ASAP.

Visual Studio is definitely a step forward from MonoDevelop and for most indies it is free to use (the full-featured Community edition).

Rider isn’t free (see pricing here). But if you are reading this you are probably either a professional, semi-professional or a very-engaged-hobbyist and you spend on average a few hours a day in your IDE. If so, than I reckon paying for software that saves you quite a bit of time each day and that also teaches you some neat coding tricks is an investment that will break-even within just a few weeks.

Thanks for reading.

Jan Mysior

@JanMysior


Related Jobs

Hipster Whale
Hipster Whale — Melbourne, Victoria, Australia
[04.01.20]

Server Engineer (Senior)
Airship Syndicate
Airship Syndicate — Austin, Texas, United States
[04.01.20]

Senior UX Designer
Blue Marble Health Co
Blue Marble Health Co — Altadena, California, United States
[04.01.20]

Programmer
Frictional Games
Frictional Games — Malmö, Sweden
[04.01.20]

Tech Lead





Loading Comments

loader image