I'm learning HLSL and I was hoping to use it to help me make a material in UDK. I'm trying to get a simple switch case to work in a custom material node, and even though I'm using the official HLSL reference, I can't seem to get it to work.

The image doesn't seem to be working here. Open it on a new tab or 
click here  
            
Replies
float4 finalValue = 0.0f; // The default value is now here. switch (indexNum) { case 0: finalValue = 0.25f; break; case 1: finalValue = 0.5f; break; case 2: finalValue = 1.0f; break; } return finalValue;Also try changing the default value from {0,0,0,0}; to simply
I plugged in your code and it seems to work. It might be because I didn't have decimal points in my float? Do I need the "f" after a float value?
No... Definitely works on my end :P
Here it is slightly different, in case you want 0 to be the default value...
float4 finalValue = 0.0f; // The default value is now here. switch (indexNum) { case 1: finalValue = 0.25f; break; case 2: finalValue = 0.5f; break; case 3: finalValue = 0.75f; break; } return finalValue;And no, you don't need the decimal or the 'f' at the end. It's just a habit I have carried over from programming :P