# Niagara Map For Not Working Correctly and How to do array add in niagara's custom hlsl, I didn't find any hlsl function for it.

**URL:** <https://forums.unrealengine.com/t/niagara-map-for-not-working-correctly-and-how-to-do-array-add-in-niagaras-custom-hlsl-i-didnt-find-any-hlsl-function-for-it/1902503>\
**Category:** FX\
**Tags:** development, effect, unreal-engine, hlsl, question\
**Created:** [June 14, 2024, 2:25am UTC](https://forums.unrealengine.com/t/niagara-map-for-not-working-correctly-and-how-to-do-array-add-in-niagaras-custom-hlsl-i-didnt-find-any-hlsl-function-for-it/1902503 "2024-06-14T02:25:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakuya\_Saki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sakuya_saki/32/624962_2.png) [@Sakuya\_Saki](https://forums.unrealengine.com/u/Sakuya_Saki)\
**Post date:** [June 14, 2024, 2:25am UTC](https://forums.unrealengine.com/t/niagara-map-for-not-working-correctly-and-how-to-do-array-add-in-niagaras-custom-hlsl-i-didnt-find-any-hlsl-function-for-it/1902503/1 "2024-06-14T02:25:33Z")

</div>

Niagara Map For Not Working Correctly  
How to do array add in niagara’s custom hlsl, I didn’t find any hlsl function for it.

My goal is to find each triangular shape of the skeletal mesh body that has a disproportionately large gap between its length and width ratio, and store the index of the triangular faces into an array

Now both of these modules don’t work properly

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/0/c/10cb6c465fbf8bdd13ab1662120b19d4e74b9a22.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/2/8/328897e5995fd9e893c1808d6ef64887b4e2dcb3.jpeg)

---

<div class="post-metadata">

**Author:** ![Sakuya\_Saki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sakuya_saki/32/624962_2.png) [@Sakuya\_Saki](https://forums.unrealengine.com/u/Sakuya_Saki)\
**Post date:** [June 14, 2024, 2:30am UTC](https://forums.unrealengine.com/t/niagara-map-for-not-working-correctly-and-how-to-do-array-add-in-niagaras-custom-hlsl-i-didnt-find-any-hlsl-function-for-it/1902503/2 "2024-06-14T02:30:37Z")

</div>

additional information

Niagara doesn’t report any error, but it’s just that my function isn’t working correctly. Theoretically, he should be giving me an array, but I’m checking later to see if it’s 0 or 1. I can’t quite remember. Anyway, map for shouldn’t be working correctly.

I’ve referenced this, but it doesn’t work.

> [@Niagara "Map For" Can't Set Array Elements](https://forums.unrealengine.com/t/niagara-map-for-cant-set-array-elements/769879/2):
>
> Hey, couple of things: You just have to connect the set array call to the map for node, e.g. by setting a dummy value (see below) You don’t have to calculate the current interation yourself, there is a node for it already You can always just pop down a custom hlsl node and write the for loop yourself. You can get the hlsl version of the data interface functions by right-clicking on the data interface pin and then go to “Data Interface Function HLSL…”

---

<div class="post-metadata">

**Author:** ![Sakuya\_Saki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sakuya_saki/32/624962_2.png) [@Sakuya\_Saki](https://forums.unrealengine.com/u/Sakuya_Saki)\
**Post date:** [June 14, 2024, 6:50am UTC](https://forums.unrealengine.com/t/niagara-map-for-not-working-correctly-and-how-to-do-array-add-in-niagaras-custom-hlsl-i-didnt-find-any-hlsl-function-for-it/1902503/3 "2024-06-14T06:50:51Z")

</div>

I iterated my code  
Now using the official function to add to the array but it still doesn’t respond Debugfloat output is always 1  
However, if I put it in the system update stage.  
The DebugFloat number keeps getting bigger, probably by 1 per frame, and I think there’s something wrong with the for loop, but I don’t know why.

Can someone help me? ：）

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/4/574e24a4660b91b304fb5b8503c8bd4b1233e8fe.jpeg)
