Do you have compression turned on in the texture import settings, or is it perhaps too low resolution?
(It might also be better for you to simply express the gradient mathematically with a lerp or smoothstep between colors, rather than relying on a texture)
I’m creating the texture by code. I create the texture based on an animation curve. Isn’t a texture like this the way to pass an array of values to the shader?
Is it? The .png you posted certainly isn’t. It has large steps between each pixel value. If it is set to use point sampling, those are going to show up as visible steps. Plus you have some parts of the gradient that have the same value for 2 pixels in a row, so even if you did use bilinear filtering it’d still show up as a band.
You need to make sure your gradient texture is using bilinear filtering, and probably also need it to be something like an RHalf texture format, something with more precision per channel than a RGB24 or R8. If you use an 8 bit per channel format, some parts of the gradient are going to quantize and get stepped.