Contents. Old Instructions / Mac Instructions Unity can now easily create a Visual Studio project for you. This is all you need if you're using Windows for development - if, however, you like to develop on the Mac and still use Visual Studio (because it's the best IDE), also have a look at the old instructions. This also has information on how to get Intellisense documentation:. / instructions for using Visual Studio on the Mac Creating a Visual Studio Solution To create a Visual Studio Solution:. Click Assets-'Sync VisualStudio Project'.
![Startpage Startpage](/uploads/1/2/5/4/125482968/908679318.png)
Starting up Visual Studio for the first time feels a lot snappier if you skip the default news page on startup. Select Empty environment under Options Turn off Track Changes. When a file is open in the code editor, Visual Studio will represent recent changes by displaying small regions of green.
Open Visual Studio. Click File-Open-'Project/Solution.'
. Locate the.sln which is likely at the root of your project. Important note about file renaming If you need to rename a behaviour (non-behaviour scripts don't matter), make sure to do it in Unity! If you rename it in VS, Unity will consider it a new file, and all references to it (components) will be lost. Then in VS, exclude the script, display all files in the solution explorer, include the new renamed script, and finally rename the class in the editor (and enjoy some sweet refactoring:). It's a tad tedious, but once you get the habit it's not that bad. Note that if you forget and rename in VS, all is not lost.
Just find the components in Unity, you'll see all their properties are still there but the script reference (it will say 'Missing Mono Behaviour'). Just drop the renamed script in the script box, and yay, you didn't lose any property! Version Control UT's Asset Server The best solution to version control for Unity is probably UT's Asset Server. I'm using this now and thus I have dropped Subversion, but for reference for people who would prefer to use Subversion: Subversion If you want version control, you may want to try Subversion: It’s very convenient to use on Windows with TortoiseSVN: One important note: In the setup I’m using, I don’t version control the actual VS.NET project. There’s not really much worthwhile version controlling in there, anyways.
Instead, I directly put the script files from my assets folder under version control. I have those on a share mapped to a drive. Don’t get confused when TortoiseSVN doesn’t automatically, create the relevant icon overlays, you need to change the settings for that to work correctly: Right click on some item in the explorer to get the context menu, go to TortoiseSVN/Settings.
In there, under Look and Feel, you find Icon Overlays, and there, under Drive Types, you’ll find Network Drives is not checked. Check it, and the world is wonderful again;-) There is also a Subversion-plugin for Visual Studio.NET 2005, but personally, I didn’t really like it. If you still want to give it a try:. If you want a great SVN plugin for VS.NET you should use VisualSVN. It is not free, but pretty cheap and it works like a charm. I would not recommend using Subversion for version controlling the binary assets - I'd only use it for scripts and textfiles.
Some people (see for an example) have reported trouble someone along the way when version controlling Unity projects (including the binary assets) with Subversion, so you have been warned;-) Subversion, another take This is drawn mostly from experiences with using Unity and SVN at the Global Game Jam 2009. As said above, scripts textfiles and also assetfiles work well with Unity.
You can also version scenes and prefabs, but since they are binary and cannot be merged - you will have to take care when a conflict arises. Typically this will mean that you have to update, make the changes you want again and then commit. Makes a good case for commiting often! The worst part to use SVN for is the Library folder. The cache should definately be ignored, and most of the other stuff - including metadata - changes so often that you always get conflicts. What we did was to ignore the library folder completely. This has the unfortunate effect that references to scrips/prefabs/assets for things in the scenes and prefabs does not get saved.
Simple properties do - just not references. This lead to tedious work of recreating what others have set up in your local copy. We remedied that by having one machine that was the master machine.
On that machine we integrated everything, build the game and made sure it ran. When this was over we shut down Unity. Zipped the library folder and put that in SVN.
Others could then update to get the zip and all changes, shut down Unity, remove the library folder and unpack the new one. Then they would be up and running.
Somewhat tedious, but it worked for us. Some nice Add-Ons to Consider OBSOLETE: One click Unity & Visual Studio integration (Mac) Note: This is obsolete since Unity has integrated creating visual studio solutions. For issues specific to Mac when using Visual Studio (in a virtual machine environment), see:.
Instructions for using Visual Studio on the Mac Check out Lucas Meijer's blog post which also has a very nice Unity package which makes integrating Unity with Visual Studio even easier: OBSOLETE: One click Unity & Visual Studio integration (Windows) NOTE: This is obsolete now that Unity has full Visual Studio solution support integrated (in particular, no reason to worry about symbolic links anymore as Unity does it all right for you). Go to Lucas Meijer's blog post and download his Unity package: Windows is not able to create symbolic links in the same way as OSX so Meijer's script needs to be modified a little:. Download Junction from. Extract junction.exe from the zip archive and move it to your Windows installation folder, normally C: Windows.
Import the package and change line 17 in CreateVisualStudioSolution.cs to. ProcessStartInfo t = new System. ProcessStartInfo ( 'c: WINDOWS junction.exe', 'VisualStudio/AssetsLink Assets' ); Now you can re-export the package for future use in other Unity projects. (Verified on Vista, should work the same for Windows XP) Consolas Fontpack Consider getting the which looks much better than Courier. Don’t forget to switch on ClearType – it’s not on by default. See instructions here: Microsoft Visual Studio 2005 IDE Enhancements You might also want to install: InternetExplorer Developer Toolbar If you’re also developing ASP.NET content, you may consider downloading and installing: UML Modelling with UModel If you’re developing complex applications, you may consider using UML to not model the various levels of the application in a more abstract manner than just code. I found Altova Umodel a very nice tool because it supports round-trip engineering and can be smoothly integrated into Visual Studio.NET 2005 and 2008.
VERY IMPORTANT: Use UModel only with version control (or make frequent backup copies of the relevant UModel project files). I almost lost a few hours of work because I rearranged the folder structure inside of Unity on time, and another time because somehow I opened VS.NET 2008 while my network connection from the VMWare to my Mac somehow was broken. The result was that UModel did not find any classes anymore and automatically removed all the classes from all the diagrams. Fortunately, I made a copy of the UModel project file before saving this disaster. So make sure you check in the UModel project file after you’ve worked on it, so when UModel does weird things, you don’t lose your precious time. Note: This never happened to me again, so I'm not saying UModel is buggy or something, but it's just wise to be a bit cautious with software;-) Using Visual C# Express As the code editor If you are using Windows and are editing C# scripts in Visual Studio or C# Express, the new 'Assets-Sync VisualStudio Project' option is nice.
However, using Visual C# Express edition, you are limited in that you cannot double-click on a script or warning/error in Unity and have it open in Visual C# Express. Here is a workaround for that limitation: 1) Download and extract to a folder of your choosing.
2) Create a batch file and put the following line: ' classexec.exe'%1 -class.cs 3) In Unity, under Edit-Preferences-External Script Editor, select the batch file you created above. 4) In Unity, after using 'Assets-Sync VisualStudio Project' and opening the solution in Visual C# Express, double clicking a script or a warning/error in the console will cause it to open in the same instance of Visual C# Express, allowing you to enjoy easy integration between the two IDEs. As an alternative, instead of downloading the ClassExec program you can: 1. Skip downloading ClassExec 2. Create the batch file, as above, but with the following line: Start '%1 3-4. Same as Steps 3-4 in the instructions using the ClassExec This method works for both Windows 7 and Vista.
Haven't tested other systems.
This is the twenty-seventh in a I’m doing on the VS 2010 and.NET 4 release. Today’s blog post continues on from the I did last week, and covers some useful searching and navigation tips/tricks you can take advantage of within Visual Studio. These tips were ones that my friend (who has blogged dozens of great VS tips and tricks ) recently recommended to me as good tips that most developers using Visual Studio don’t seem to know about (even though most have been in the product for awhile). Hopefully this post will help you discover them if you aren’t already taking advantage of them. They are all easy to learn, and can help save you a bunch of time. Ctrl + i - Incremental Search Most developers using Visual Studio are familiar with the “Find dialog” that you can launch by pressing the “Ctrl + F” key within the IDE.
A surprisingly large number of developers, though, aren’t familiar with the “Incremental Search” capability within Visual Studio. This enables you to search within your current document, and enables you to do so without having to bring up a dialog. Using Incremental Search To enable incremental search, just type “Ctrl + i” within the editor. This will subtly change your cursor, and cause your status bar at the bottom left of the IDE to change to “Incremental search: (search term)” – you can then type the search term you are searching for and the editor will search for it from the current source location you are on (no dialog required). Below we did an incremental search for the term “action” and VS highlighted the first usage it found within the file: We can then press “Ctrl + i” again to find the next usage of the same term (and continue this repeatedly): Pressing “Ctrl + Shift + i” will reverse direction on the search, and allow us to skip backwards. You can press the “Esc” key at any point to escape out of incremental search.
More details on incremental search can be found. F3 and Shift+F3 – Find Using Previous Search Term One neat tip to know about incremental search is that after you press the ESC key to escape out of it, it will add the term you searched for to the find stack within the IDE. The search term you used will show up within the “find” drop-down within the VS 'standard toolbar: You can always press the F3 key within Visual Studio to repeat the last performed search at a later point. This is particularly useful for scenarios where you search for something, make a code change, and then want to continue from that point in the code. Just press F3 and you’ll repeat the last search (in this case “action”) from that new point in the document – no need to re-type it.
Pressing “Shift + F3” will do a reverse search (from the current cursor location in the editor) of the last search term used. You can easily toggle using F3/Shift+F3 to search forward and backwards within your document. Ctrl + F3 - Find Using Current Selection Another neat searching trick that you can use to avoid having to type your search term is to simply highlight a word (or part of a word) within the code editor, and then press “Ctrl + F3” to search for the next usage of it within the current file: Pressing “Ctrl + F3” will search for the next instance of the text you have highlighted – allowing you to avoid having to type it: Like before, you can use “Ctrl + Shift + F3” to perform a reverse search if you so choose, to search backwards within the document. Ctrl + Shift + F – Find in Solution Sometimes you want to search across your entire solution. “Ctrl + F” will bring up the find dialog and default it to search within the current document. “Shift + Ctrl + F” will bring up the find dialog and default it to instead search across the entire solution: Doing a search like this will bring up the “Find Results” window within the IDE and allow you to navigate to each found instance of the term: You can double-click each item in the “Find Results” window to navigate to that instance of the search term you searched for.
One tip a lot of people don’t know about is the ability to press “F8” or “Shift + F8” to navigate to the next/previous instance of that search term in the list. This can make navigating through them much faster/easier, and avoid you having to use the mouse. Shift + F12 - Find Usages Most developers using Visual Studio know how to highlight a type and press F12 to “go to definition”. This will bring up the definition of a class/type, and is a useful way to navigate to where it is defined. Many developers don’t know about “Shift + F12” – which brings up all usages of a particular type. This enables you to quickly see how a particular type is used.
To take advantage of it, simply select or move the cursor onto a type and press “Shift + F12”: This will then bring up a “Find Symbol Results” window that list all usages of this type within the current solution: Like with the previous tip, you can use “F8” and “Shift F8” to navigate forward/backward within each item within the list. Ctrl + Minus and Shift + Ctrl + Minus - Navigate Backward/Forward Have you ever navigated to a different code file, looked at something, and then wanted to navigate back to where you came from? For example, you use F12 to “go to definition” and then want to return back to the code that used it? A feature that a lot of people don’t know about in VS is the “Navigate Backwards” keystroke – “Ctrl + (minus key)”.
This will navigate to the previous document/location on the navigation stack. To see this in action, try selecting a type in Visual Studio. Below I’ve selected the “IController” interface: Press F12 to navigate to the definition of it. This opens up a new editor window with the source of the selected type: Now to jump back to where we came from, press “Ctrl + (minus key)” and VS will take us back to where we were: If you want to move forward in the navigation stack (which in this case would take us back to the IController.cs file), then press the “Shift + Ctrl + (minus key)”. Sara Ford has a, and explains the conditions when a new location is pushed onto the navigation stack. Ctrl + Alt + (down arrow) - Navigate to an Open File Ever have a ton of files open within the IDE, and want an easy way to navigate between them? One useful key sequence you can use is “Ctrl + Alt + (down arrow)” – this will cause a drop-down to appear within VS that lists all open files within it: You can use the arrow keys to select the file you want to navigate to – or better yet just start typing the file-name and Visual Studio will highlight it for you within the list.
For example, above I typed “Mo” and Visual Studio highlighted “ModelBinder.cs”. Pressing the “enter” key will navigate me to that file: This provides a nice, convenient, way to navigate between files without having to use the mouse or take your hands off the keyboard. And remember that “Ctrl + (minus)” can be used to navigate you back to where you came from. Navigate To, View Call Hierarchy, and Highlight References Features Visual Studio 2010 brings with it a bunch of new code navigation and searching features – including the new “Navigate To” dialog, “View Call Hierarchy” feature and Highlighted References Feature. I previously blogged about these three new VS 2010 features. If you haven’t already read this post and explored these capabilities, I highly recommend doing so – they are some great additions.
Other Editor Improvements There are a ton of other code editor improvements in VS 2010 – many of them ones I’ve blogged about before. Here are links to a few of my previous VS 2010 editor blog posts:. Also check out the other blog posts I’ve done in this.
Summary Most of the above features have actually been in Visual Studio for several releases – but are ones that a surprising number of developers don’t know about. Hopefully this blog post helps provide a convenient way to get started with them if you didn’t already know they existed. If you need help remembering the keystrokes – print out a copy of the and keep it near your monitor. To learn even more cool Visual Studio tips/tricks, subscribe to Scott Cate’s excellent (which is already up to 83 awesome tips and tricks).
Also subscribe to – she has an awesome set of tips/tricks that go back years. Hope this helps, Scott P.S. In addition to blogging, I am also now using Twitter for quick updates and to share links.
Follow me at. 31 Comments. That's grat,but what about unicode?is it supported? -.
Did LINQtoSQL designer or EF designer have some search functions? Or, maybe there is a some extensions exists for searching table by name in designers?
VAI -. Wow, I'm going to use Ctrl + F3 all the time, thanks for the tip! (btw it seems to work in VS2008 too) Regarding incremental search, it's quite handy but it has an annoying limitation: it doesn't search hidden text. Is there an option somewhere to change this behavior? -.
![Yahoo start page Yahoo start page](http://www.thatjeffsmith.com/wp-content/uploads/2014/09/tree_filter.png)
Great Post. I feel the ReSharper does the good job and reducing most of the development time. What you feel scott? -. Frankly, I never understood why Ctrl + Minus and Shift + Ctrl + Minus are used for navigation when the windows standard is ALT + LeftArrow and ALT + RightArrow. I always rebind these keys to navigate backard and forward but it's a pain when i'm working on someone else's computer.:) Eyal -.
There's also Ctrl-Shift-8 (C-.) that pops an item from the F12 'stack'. For instance, if you do F12 then page down (or any other action that pushes another item on the go-back list), you'd need two Ctrl-Minus to go to the location where you pressed F12, but C-. will take you there directly. This is very handy for Emacs and Vi veterans, which are used to their tag stacks and look for something similar in Visual Studio.
Sadly, C-. is not mentioned often. Luckily, it is still present in Visual Studio 2010:-) Miron Brezuleanu -. Great post! Admittedly I didn't know about the incremental search feature, so thanks for pointing it out as it's pretty useful!
-. I like the Ctrl + i - that's exactly what I was looking for! Yair -. Nice post.
Thanks Scott.! -. It would be useful if the 'Find in Solution' results had a ghosted path to make identifying the file name a bit quicker. For my part I would like to see the file name first and in its own column. Crispin -. Thanks for these tips, some are pretty handy indeed!
Sadly, there is one that does not work with French OS/keyboard: NavigateBackward. It seems to be assigned to Ctrl+, which I cannot type on my keyboard (I need to type Alt+0183). I know I could reassign it, butI think all combinations with Ctrl are already assigned to something else and i don't to mess around too much with them. And it is strange that the shortcut does not work out of the box. Damien -. @Thomas Levesque,'I'm going to use Ctrl + F3 all the time, thanks for the tip!
(btw it seems to work in VS2008 too)' FYI, it dates from the Visual C Developer Studio IDE, i.e., from at least VS 6 - probably there from earlier but that's when I first saw it used, by watching another developer!:) I'm always discovering new tricks in VS! But there are a few other tips in this post that I was unaware of and one I'd forgotten about. Kevmac -.
With all these productivity tools available for Visual Studio it's amazing how little we have for MSSQL. In a day-to-day development I frequently need to lookup a table and usually faster to scroll up and down until I see it. Filtering is nice however the implementation is terrible. How about filtering as I type? 99.99999% of the time I'm searching for a table or stored procedure and this dialog box is just too awkward to use.
And I don't think it's too different to implement. I'm just thinking out loud. Nsimeonov -. Pure awesomeness Scott. I did not know all these shortcuts, but need them all the time! Oh, and I also agree with the previous poster re searching sql tables currently is easiest scrolling up and down.it could use a little bit of your magic. Mike -.
Incremental Search is working as Alt + i for me in a VB.Net Environment Michael -. I got awfully excited when I saw the ctrl+i search mechanism! Until I tried to use it. The area where the search text is 'entered' is not highlighted as an editable field. Thus it is all to easy to make a mistake in typing and not really notice because your eye is not drawn to the bottom left.
Pasting from clipboard and/or defaulting to clipboard contents is not supported. Manually typing can produce more errors The best search example in a graphical UI that I use on a regular basis is that in Firefox 3.6. The workflow is this: - ctrl-f (if not visible, makes the search taskbar visible) sets the focus to the search field.
Hitting Enter will begin the search, with consecutive Enters finding the next search result. Shift+Enter goes in the reverse direction. and my favorite feature: 'Highlight all' which highlights all matches in a horridly bright color allowing you to scan the entire document very quickly. Now, maybe I have trained myself to use the Firefox search utility which is why I feel comfortable with it. But I do feel it is a good example of a non-intrusive inline search. Or, we can all just use VI to edit:) VIemu anyone? Rodney Thomson -.
The Ctrl + i thing is new, I'll have to try it out. For SP1 can you have your devs make the search popup remember its settings? It's very glitchy with RTM here. Gets annoying. Sliderhouserules -.
I used to use the Incremental Search a lot until I figured out it does not search hidden text. I wish this limitation would be removed. Darrell -.
Extremely useful to know these short-cuts. Definitely increases my productivity & fondness of visual studio. Thanks for sharing this tips with us. Instead of Ctrl + Alt + (down arrow) and then Enter I'm rather using Ctrl + Tab (so I think it's a mistake to shorten the file names in this window with dots). Nice article, thx. NoName -. These are simple, though quite helpful VS.NET search tips.
I knew most of them, but didn't know about some others, such as: after Thanks! -.
Turns out Ctrl + Alt + Down Arrow flips everything on my screen 180 degrees. Now that's odd. Otherwise, helpful tips. Thanks for these tips, some are pretty handy indeed!
Sadly, there is one that does not work with French OS/keyboard: NavigateBackward. It seems to be assigned to Ctrl+, which I cannot type on my keyboard (I need to type Alt+0183). I know I could reassign it, butI think all combinations with Ctrl are already assigned to something else and i don't to mess around too much with them. And it is strange that the shortcut does not work out of the box.
It never worked for me. Although CTRL+ (plus) never worked also. It used to on vs2008.
useful one. Backward and all always useful. Yes ctrl+alt+downarrow flis the screen -. Searching within Hidden text is a must! How did that slip through the net?:) -. Thanks, -. Just so you know, When using the Ctrl+F3, you don't have to highlight what you want to search for.
If nothing is highlighted, the IDE will search for the word that the cursor is over. John -. Interesting and impressive as always. Why hasn't anyone told me about Ctrl + Shift + F before?! If you have any more of these please write another one of these because I didn't know about most of them and I feel like they could save me a ton of time.
excellent information. I always forget some of the naviagation.