How can I set an integer to a material parameter?

How can I set an integer to a material parameter? Say I have a custom shader node, which has int TexWidth; How can I set integer from the C++ end? I don’t seem to find related api other than set scalar or set vector which are for floating point values

Hi Anning5,

There are just the scalar and vector parameters - you’ll need to cast it to an int in your HLSL code - often the “TexWidth” value is used to calculate the Texel size, which would require a float to get the correct result anyway - but if it’s for looping or something like that, yes it will be more efficient as an int.

I see, thank you!