Need a little help iterating through an array of positions inside of a shader (ASE)

Hi first of all I want to say that I’m using Amplify because so far I just know the basics of shader coding, also I want to point out that I know this isnt the best place to post this as Amplify has its own forum and in fact I posted my question there too but there doesnt seem to be almost anyone looking over there so I’ll post it here in the hopes that someone can give me a little tip as I’m pretty stuck.

So having bought Amplify like a couple of days ago I tried doing various shaders of different types (extremely simple ones obviously) and I tried doing some shader that would change the texture depending on the distance from a given position, the node setup looked something like this:

And the result, as expected was something like this:

But then I wondered how could I do this effect in a more dynamic fashion? Like what if I wanted to have more than one sphere have this effect without having to wire everything for every sphere, so then searching I found that I could create arrays through C# code and send them to the vector using a Material Property Block, setting a vector array there and then setting that property block to the renderer of the plane, then in amplify there is a node called Global Array where you can get the value of an array of any type and surprisingly it worked, I had the positions of all the spheres and with this node I could change the index of it so I could set what sphere had the effect, but what if I wanted to have ALL the spheres have the effect at the same time?

I’ve googled a ton today but so far no luck, I found out that there is a “Custom Expression” node so I thought I could write my own for loop and just set that to the index of said global array, in fact it kinda worked, the node setup ended up like this:

And this is the “Custom Expression” node:

Like I said, it “kinda” worked but the problem is that that for loop that I wrote always returns the first value (for example int i=0; i<2; i++ return i) always returned a 0 and didnt iterate through the loop

So far this is what I’ve been able to do on my own, I tried a bunch of different stuff but so far no luck, I dont know how to fix this, I know that you can use loops through code in shaders but would like to know if something like this is possible inside of Amplify.

If you’ve read all this nonsense that I just wrote thank you and sorry for my poor english.

Thanks again for your time!

have you solved this error yet?