Lately I’ve been trying to get Visual Studio to play nice with shader files, but it’s almost worse than Notepad from what I can tell.
It completely messes up the indenting and brace placement in a shader file and there’s no code completion whatsoever. And I’ve tried both the shader extensions I found extensively. These two: https://nshader.codeplex.com/
I get an attempt at syntax highlighting using them, but that’s about it.
I’m using Visual Studio 2015 Community at the moment.
Since writing shaders is such a big part of game development surely this is something most of you have solved properly? So how do you do it?
I feel so lost when I get into situations like these, lol. Visual Studio is such a nice IDE and it’s so widely used, it seems unbelievable to me that it doesn’t support shader files properly. Aren’t games basically as good as their shaders? Where are they written? And the shaders in Unity are generic, right? So even games made in proprietary engines would need the same shader writing capabilities that we need? This makes no sense to me.
Even more confusing is how few topics there are about this. It’s as if everyone has a tool for it and therefore doesn’t need to ask, but the questions I find are exactly the same questions I myself have.
From 2012, no good answer:
This Visual Studio plugin has a comment from just a few weeks back detailing the exact problems I have (and code completion doesn’t work, despite what the plugin claims):
There are some people who claim the shader plugin for Visual Studio works in VS 2013 so perhaps I have to downgrade?
But even if I exclude Visual Studio from my queries I get no good results.
Writing shaders is such an awful experience for me at the moment compared to writing C# code, XML, JSON, PHP or any of code I write at work, but there’s no reason it should be like that. I mean, clearly nobody who writes shaders for a living is doing it without auto-completion, proper syntax highlighting and indenting?! Or are they?..
In my experience shaders are either created in a visual editor (in which case much of the above isn’t relevant) or they’re done in an external text editor (Notepad++, Sublime Text, etc). I don’t think many people spend enough time editing shaders for this to be a big dealbreaker, which is why you’re not seeing many other people talk about it.
For what it’s worth, I write shaders using Script Inspector 3 (just like all my other Unity code). I haven’t noticed any problems with indentation or syntax highlighting, but I haven’t done it enough to notice whether it’s offering useful autocompletion.
It’s been many weeks since I last launched any external code editor. (I only need to do that for stepping through code in the debugger, which is fairly rare.)
Thanks for the replies. I must never have gotten a notification for your reply, Kylotan.
But there’s guys like Sonic Ether, and I assume people making games for a living, who spend almost all their time writing shaders. I have such a hard time accepting that it’s this bare bones for them. Shaders are extremely hard to debug, I sort of understand that this is just because how they work, but I don’t understand why you can’t write them than the same way you do any other code. I don’t think I’ve written code without code completion ever, until I encountered shaders.
This thread desperately needs a bump. I’ve been writing shaders on and off for awhile now, and every time I get the motivation to dig around for a better IDE/setup I get disappointed. I understand that writing a Language Service for Visual Studio or something isn’t really a trivial task, but has anyone given it a shot or talked to Unity about it?
I don’t know anyone off the top of my head on these forums who writes shaders for a living, but I have a sneaking suspicion @bgolus might.