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

Visual Studio not using highlighted syntax for Unity classes

Discussion in 'General Discussion' started by ProgrammerGuy1500, May 20, 2019.

  1. ProgrammerGuy1500

    ProgrammerGuy1500

    Joined:
    Jul 7, 2017
    Posts:
    13
    Hey, so I installed Unity recently and have been trying to figure out how I can use preferably Visual Studio to use syntax highlighting/intellisense for Unity classes and their framework.

    No success yet, Unity apparently has no actual support email for general questions like this, and I made another thread awhile back with no response yet.

    I guess if this continues I won't be developing in Unity after all...

    Thanks for reading this.
     
    Mkkhell likes this.
  2. chris_gamedev

    chris_gamedev

    Joined:
    Feb 10, 2018
    Posts:
    34
    I have had very mixed success with IDEs over time with Unity.

    The editor that I have had the most success with is actually Visual Studio Code.

    upload_2019-5-20_17-40-12.png

    There is a Unity specific guide for setting it up, here:

    https://code.visualstudio.com/docs/other/unity

    It's also worth noting that opening up just a random script directly from a file may leave Intellisense in a non-functional or incomplete state, so I tend to always open the code via Assets > Open C# Project. It might be worth checking if that's actually your current issue with full VS - I think the full project/solution needs to be opened for full IDE functionality.

    But, honestly, I'm a big fan of Visual Studio Code as a general text/code editor and it's working great for me right now for Unity development so likely to be sticking with it :)
     
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    What have you tried?

    I allowed Unity to install Visual Studio from its installer. Then I open a Unity project. From the Unity Editor, I double-click a script file in the Project panel and it opens in Visual Studio, with syntax highlighting, intellisense, and so on.

    Which part of that doesn't work for you? When it goes wrong, what is wrong?

    For what it's worth, the General Discussion section is specifically labelled as not being a support area. Scripting would be the place to post this type of thing.
     
    Ryiah and ProgrammerGuy1500 like this.
  4. RACKSHACK51

    RACKSHACK51

    Joined:
    May 9, 2021
    Posts:
    1

    yea i had the same problem as well, i downloaded visual studio code instead and it works like a charm
     
    Boden_McHale likes this.
  5. Mkkhell

    Mkkhell

    Joined:
    Sep 12, 2021
    Posts:
    1

    Forever grateful my friend.
     
    Boden_McHale likes this.
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,951
    Be prepared for it to eventually break. I don't know of anyone that hasn't had to deal with it at least once.
     
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,553
    The post you've responded to is from May.

    VS code autocomplete occsionally glitches out, but this is fixed by axing all *.csproj files and forcing unity to regenerate.

    It is also much more pleasant to use in C# mode than Visual Studio.

    One real problem I encountered with it was Android debugger failing to work with breakpoints. Everything else worked fine.
     
    Boden_McHale, stain2319 and Ryiah like this.
  8. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,951
    I only responded because people keep finding this thread.
     
    angrypenguin likes this.
  9. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    Jetbrains Rider has great support for Unity and probably the best editor out there for it, and probably the best C# code editor there is today.
     
    Ryiah and angrypenguin like this.
  10. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    While I agree, I'd only recommend it for experienced developers. For beginners there are free options out there which are at least as good for learning, because you should walk before you try to run.

    If a newbie wants to spend $139 to improve their programming, that's not the first place I'd spend it.
     
    Meltdown and neginfinity like this.
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,951
    Speaking of which I finally picked it up recently and I'm adjusting to it far faster than I thought I would.

    Or $149 if you like getting six products instead of one. :p
     
    Meltdown likes this.
  12. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,553
    Except it is subscription based.

    Visual Studio Code is free and is decent enough, and I've recently started using it instead of PyCharm. Mostly because apparently it is possible to write blender scripts on it with full code completion for symbols within bpy .

    It woudl've been even better tool if it weren't written in Electron.
     
  13. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    I pay $14 a month for a Rider + Resharper subscription.

    Newbie can quit after a month if the sweet temptations of Rider's shortcuts don't lure them into the murky depths of coding efficiency..
     
    Last edited: Sep 13, 2021
  14. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    Nice, I'd highly suggest promising to teach yourself 'one new shortcut' per day.

    I also use it now for any ASP.NET/Azure development. The Azure Toolkit for Rider works really well.
    I'm migrating my game to Playfab due to the Gamesparks shut down, and I must say it is an absolute pleasure writing cloud code in Azure Functions using Rider.
     
  15. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    I find it hard to put a price on something I use 8-10 hours a day, especially if its only costing me $14 a month.
     
    angrypenguin likes this.
  16. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    They're a newbie learning as they go. They aren't going to achieve "coding efficiency" any time soon, and no tool is going to change that, and that shouldn't even be on their radar at that stage.

    Like I said, walk before you run.
     
  17. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,553
    I'm stingy, very careful about my finances, live in another country and there are subscription services that I use that offer far more while costing less. I also really dislike subscriptions and SaaS

    In order for me to get rider they'd need to offer a substantial improvement over VS code OR offer a perpetual license, OR drop the price.

    Right now it doesn't look attractive in any way, it is like trying to convince me to switch away from Blender to Maya.
     
    Last edited: Sep 13, 2021
  18. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Fair enough, too. It wasn't attractive to me at all until VS's misbehaviour annoyed me so much that I just wanted something else. To me Rider does have a "substantial improvement" in comparison to VS in that Rider works reliably. Separately, I'd pay the asking price for the upgraded debugger alone, too.

    Still, if VS worked reliably with Unity I'd happily go back to using it if I had some reason to.

    That all said... if you're working professionally as a programmer I'm confident it would earn its price back pretty quickly. So the price is really a non-consideration to me.
     
    Meltdown likes this.
  19. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,553
    There's Visual Studio, and there's Visual Studio Code. At the moment I'm using Code, because Visual Studio (Community) has a auto formatting quirk that greatly annoys me, and MS refuses to fix it. VS Code does not have it, and that's why I'm using it.

    You can chalk it up as a personal preference, in the end.
     
  20. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Yeah, before I trimmed it down that post talked about how both versions of Visual Studio misbehave for me, with a cost far higher than the few dollars a month JetBrains were asking for.
     
  21. Actually after a year you can decide to stick to the version you have and stop paying. You can keep the last version. Just like the Substance "subscription" worked. Obviously you won't receive substantial updates after that point, but if you don't rush to upgrade your Unity versions under your project, it works just fine, you mainly lose out on new feature support.
     
  22. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,553
    Their site says that you don't get to keep the last version. You keep the first.
    Or to be precise you keep the version that has been available at the start of your subscription period.

    There's even a picture.

    Either way, not a fan.
     
  23. Don't mind the big bold text which says "lasts less than one year". If you fill up the 12 consecutive months, you keep that version.
     
  24. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,553
    No. You subscribe, and at the start of the period you have version X. 3 months before your subscription ends, they release version X+1. When subscription is over, you get version X, and not X+1. Hence you don't get to keep the last version. To qualify for X+1 you'll need to prolong your subscription by 9 more months, and then they can just release X+2 right before your subscription ends so the cycle repeats. At least that's what the information on their site says.

    Anyway, like I said, not a fan.
     
  25. Yeah, I just realized that it's a bit more complicated because the fallback license depends on the number of months you're paying after the release, not after your subscription starts.

    Anyway, for me it's not that important, I pay $83 per year and happy with it. $7 per month is way in my budget, and it would be even if I wouldn't use it professionally. Small price to pay to not to deal with VS and VSC chunkiness and problems.
     
    Meltdown likes this.