title: 2D Array Gradient Generation in Unity
body: <p>I'm still fairly green to programming and I'm trying to write a function that generates a 2D array of custom size[x,y] and will fill it with values between 0 and 1 gradually, creating something of a square/rectangular gradient.
  Like this: <a href="https://i.stack.imgur.com/MWHrv.png" rel="nofollow noreferrer">https://i.stack.imgur.com/MWHrv.png</a></p>
  <p>For example:</p>
  <pre><code>[1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][0.8][0.6][0.6][0.6][0.6][0.6][0.8][1.0]
  [1.0][0.8][0.6][0.6][0.6][0.6][0.6][0.8][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0]
  </code></pre>
  <p>I've been trying to do it for a 16x9 array for now, but it has to be usable for 100x100+ arrays.
  Spent quite some time on it, but to no success, so I hope someone can help.
  The closest i got was</p>
  <pre><code>[1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][0.8][1.0]
  [1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0][1.0]
  </code></pre>
  <p>And after that a lot of weird combinations.</p>