I was trying to fix the error in the RemoveItem function in the inventory component before I saw the end of this video and came across something odd. The 'subtract one from a specified value and then set it' node was not just decrementing and setting the stack size, but also the inventory array index. I replaced the -- node with a simple subtract node and that fixed the errors.
@thegamedevcave15 күн бұрын
if youre using the decrement node inside a function it's likely that you're already using a copy of the variable youre trying to change, instead of a reference. when you input a float value into a function as an input, it actually makes a copy of the value to use, instead of using the original value. unless you mark the input parameter as a pass by ref, which will allow you to edit the original value inside the function. glad you found your own workaround though!