Grid without 0?

I have a grid of planes (100x100) using a couple of FOR loops…

Is there any way to have the range -5x5 and leave out 0?

Not with a loop. You have many methods, including

  1. Write your own macro

  2. Write your own increment function

  3. Use two loops ( for each range )

The macro is

and the function

image

1 Like

Is there any reason why you would modify the default For loop for this, instead of adding an offset int or vector value to your for loop output?

you could do something like this to create a grid:

int OffsetX = -20;
int OffsetY = 40;

for (int X = 0; X < 10; X++) {
  for (int Y = 0; Y < 10; Y++) {
    MyGrid->AddPlane(MyPlane, X + OffsetX, Y + OffsetY);
  }
}

//// 
void MyGrid::AddPlane(UUserWidget* InPlane, int InX, int inY) {

}

Thanks, will have a try.