I found the Wrap (Integer) node today and was excited to use that for wrapping around arrays but it seems to never wrap to the bottom value.
So with a Min of 0, a Max of 2, and an Value of 3 the Integer (Wrap) will select 1 rather than 0 which is what I would expect. It can’t be worked around by simply reducing the min value by 1 as it will return 0 if 0 is given in the above example.
Below are screen shots of the blueprint that I used to test the value 0, I replicated the same blueprint but updated the values as indicated in the screen shot within the game.
Am I missing something obvious in how this is supposed to be used or is this a bug?
This seems to be an awkwardly named method.
The wrap node is from the KismetMath library and is commented
/** Returns Value between A and B (inclusive) that wraps around */
The library is just a wrapper to another library (FMath) which comments the same method as
/** Wraps X to be between Min and Max, inclusive */
This wrap node does not at all as you would expect wrap “around” to the Min or Max number, instead it returns a number within the min and max.
If you want to wrap around an array you should write your own macro to do so. A macro because macros work with arrays of any datatype, similar to a templated method.