# Reverse Array Count Not Working Properly

**URL:** <https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [December 6, 2025, 12:48am UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536 "2025-12-06T00:48:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Impudent\_Swine](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/impudent_swine/32/1121349_2.png) [@Impudent\_Swine](https://forums.unrealengine.com/u/Impudent_Swine)\
**Post date:** [December 6, 2025, 12:48am UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/1 "2025-12-06T00:48:51Z")

</div>

I have a button to siphon through an array of cameras and I am trying to make a reverse button for the index but the button with the reverse node acts erratically when pressed, either just going to the next camera like the other button without the reverse node, or not doing anything at all. The “back” button works just fine but when I try to add the reverse node or use a subtract one, it wigs out and doesn’t work right.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 6, 2025, 1:26am UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/2 "2025-12-06T01:26:20Z")

</div>

Why not just use the index of the array of the cameras?  
Use an int for the current camera and wrap it to the amount of cameras.  
One button increases the index, the other decreases, finally wrap index to keep in the array bounds.

---

<div class="post-metadata">

**Author:** ![Impudent\_Swine](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/impudent_swine/32/1121349_2.png) [@Impudent\_Swine](https://forums.unrealengine.com/u/Impudent_Swine)\
**Post date:** [December 6, 2025, 2:56am UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/3 "2025-12-06T02:56:07Z")

</div>

> [@3dRaven](#):
>
> Why not just use the index of the array of the cameras?

Isn’t that what this is doing in the event graph? I use the “GET” node to grab the array and use the index to go through it one by one, though I would prefer to be able to select each camera individually, as I think that would be a more user friendly method.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [December 6, 2025, 4:24am UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/4 "2025-12-06T04:24:21Z")

</div>

> [@Impudent\_Swine](#):
>
> Isn’t that what this is doing in the event graph?

It’s changing the order on every reverse: index 1 would be the second camera but when reversed and moving 1 left it would select the last camera, not the first one.

For the index to wrap around going left do this: `(index - 1 + Length) % Length`. No need to reverse the array.

---

<div class="post-metadata">

**Author:** ![Impudent\_Swine](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/impudent_swine/32/1121349_2.png) [@Impudent\_Swine](https://forums.unrealengine.com/u/Impudent_Swine)\
**Post date:** [December 6, 2025, 7:12pm UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/5 "2025-12-06T19:12:54Z")

</div>

If you mean to swap out the add node for a subtract node, I tried that but the button just gets stuck on the player’s camera and displays it at a weird angle for some reason.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 6, 2025, 9:27pm UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/6 "2025-12-06T21:27:03Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/6/9064fe91df1532aa4a1a924be61135e1177c79c3.jpeg)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/8/2484ce1dc1dd89a57f5727a2397a51d81575b5e4.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/4/53420420bec68f607719b8e11ef547448a47e85f.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/e/18e4317250081e1cda1e5df9f9956396af2bf468.jpeg)

> **[CameraSwitchUI\_2025.zip](https://drive.google.com/file/d/1Jf0m1NUfDfQRWI_MzEXCdNhIaDQ0mhbY/view?usp=sharing)**
>
> Google Drive file.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [December 6, 2025, 9:53pm UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/7 "2025-12-06T21:53:59Z")

</div>

Here is an example:

> **Moving right**
>
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/e/9/de9ecfc837890dbe59bff862b4bcf3e7226c4b76.png)

> **Moving left**
>
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/0/a703931f1a061ab0b6ffa93ed5282f9ba91411b9.jpeg)
> 
> Edit: correct image.

> **Toggle buttons**
>
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/e/72ed816cd78ec5f9b82b85e96778fad916fbaed1.png)

Result:

![wrapingIndex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/0/050462043ed1dd4aa48bdffc63337dac53872a90.gif)

---

<div class="post-metadata">

**Author:** ![Impudent\_Swine](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/impudent_swine/32/1121349_2.png) [@Impudent\_Swine](https://forums.unrealengine.com/u/Impudent_Swine)\
**Post date:** [December 6, 2025, 10:56pm UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/8 "2025-12-06T22:56:34Z")

</div>

Apologies for the confusion I have never used indexes before. So I understand how to set up the math formula but I don’t know where you get the “active/not active” buttons from, or what the “W Icon” is supposed to be. I am also setting my buttons up directly in the events so the setup difference is also somewhat throwing me off, sorry.

EDIT: Oh, wait, I think it’s working? I fiddled around with the math nodes and tried just attaching the expression to the length instead using nodes to perform the operations manually, and it seems to be working as intended now. Thanks to the both of you!

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [December 6, 2025, 11:31pm UTC](https://forums.unrealengine.com/t/reverse-array-count-not-working-properly/2682536/9 "2025-12-06T23:31:56Z")

</div>

For what its worth here is the project I did to record the gif above.

[WrapIndex.zip](https://forums.unrealengine.com/uploads/short-url/6iIIrjThFUc2cN2tcA7ppARgCWi.zip) (67.0 KB)
