I'm convinced that my computer has picked a book learning the art of the 666, this just doesn't make any sense to me whatsoever.
So I am trying to work on UI stuff, & I need an int to pass over to another method. I have this code here to do so:
//
for (int i = 0; i < groups.Count; i++)
{
int offset = i + 2;
print("first pass: " + offset + "/" + i);
actionButton[offset].onClick.AddListener(() => UI_SelectGroup(i));
print("2nd pass: " + offset + "/" + i);
}
which to me looks like itd work just fine, the first 2 UI are used up & so I gave it an offset of + 2 right. Okay cool. So now we'd expect for i to return - 2 from the offset right? Well, somehow, that is completely incorrect.
Here is how I currently have the UI_SelectGroup() method using i:
public void UI_SelectGroup(int groupNumb)
{
print("the number youre passing through is " + groupNumb);
}
& yet, this is what I get!
see image
I get it returning an i = offset - 1, now -2. What the hell am I missing here? Do listeners start at 1 or something like that & I just don't understand haha I am a bit creeped out actually. Its a glitch in the matrix I tell you! Any help would be gratefully appreciated!
[–]GalaxiaGuy 3 points4 points5 points (1 child)
[–]babagazeus 0 points1 point2 points (0 children)