Weird Visual Studio Problem

Hi! I started getting this “Unused member” errorline in Visual Studio code and have been unable to find a way to suppress it.

It’s mostly annoying but it treats Unity’s callback functions as unused methods in the software.

Deleting Library file did nothing, Regenerating project files did nothing.

It was from a recent update… It is just meant to inform you that the variable or method is not being used, but it is! It is being used by unity which is a separate program and VSCode does not know that…

Follow these instructions if you want to change the color to transparent for Info’s (Blue squiggly):

How to open VSCode settings page (Ctrl comma on Windows, or Command comma on Mac)

Opening settings.json file in visual studio

Now navigate to upper right corner and click settings.json button.

Removing red wavy underlines by setting them to transparent color

Now under workbench.colorCustomizations, change the following 3 properties:

“editorError.foreground”: “#00000000”, // Red Squiggly, I suggest not to change this one…
“editorWarning.foreground”: “#00000000”, // Yellow Squiggly, I suggest not to change this one…
“editorInfo.foreground”: “#00000000”, // Blue Squiggly, you could even change it yo something almost completely transparent so it doesn’t bother you as much…

If you don’t have workbench.colorCustomizations, you can add it into your existing settings.json file yourself. (Empty settings.json files are common after a new VSCode installation.)

The solution is to simply change the color of the underlines to a transparent HTML color, by adding two 00 to the end of the hexadecimal color value.

It doesn’t matter what color you set it to, as long as it has two trailing 00. Because HTML colors follow the pattern: RRGGBBAA, where AA is the alpha channel you want to tamper with.

So for example #ffffff00 this color is white with alpha transparency of 0, which is invisible. Setting this color to your error and underline property in settings.json will change ALL of your underlines to an invisible color. They’ll still be there, but you won’t be able to see them. And that’s as good as disabled.

I used:
“workbench.colorCustomizations”: {
“editorInfo.foreground”: “#ffffff15
}

image

Makes it white but less opaque so its like a dark gray you hardly know its there

Blaze

1 Like

It’s a warning, not an error. In this case, gridLayoutGroup is unused.
I use Rider, rather than VSC, but the same callout is made. Start() doesn’t get flagged in Rider because it knows that’s a Unity Callback function, but you’ll always get that with the Unity Callbacks in VS Code.

Where it comes in handy is when you’re polishing your project. I’ve often changed directions in a class leaving a method or member variable behind. This helps you find these orphan code elements quickly. You can’t make it go away, but Bryan has the right of making those squiggles different colors.

Thank you. This is good enough for me :smiley:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms