Search Unity

Question Visual Studio Code unused variables

Discussion in 'Scripting' started by xXBlueFire, Mar 8, 2021.

  1. xXBlueFire

    xXBlueFire

    Joined:
    Mar 18, 2020
    Posts:
    3
    Hi!
    so I started using VS-Code to write my scripts but I'm really missing the feature of fading out unused variables like in Visual Studio and I can't imagine that there is no way to activate it.
    The thing is that unused varibales inside of functions do fade out but every variable I declare outside functions do not. In Visual Studio they do.
    Maybe somebody know how to fix it?
    I only use the C# extension for VS-Code.
    I also tried the Roslynator extension and actually with the extension unused variables outside functions are now faded out and underlined but it also underlines to much other stuff I don't want to be underlined like lines that can be simplified or just empty lines to make visual breaks between code parts and this is kindy annoying.
    Also I didn't really know where exactly to post that question, so sorry if it is the false sub-forum^^'
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    I'm not 100% sure Visual Code supports that, but I imagine these steps for Visual Studio (converted to work for Visual Code) might make it work:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the VSCode package inside of Unity: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874