Closed RyanKruse closed 3 years ago
Hi, so I've encountered a programming exercise for shifting array elements left.
Current solutions on Stackoverflow involve ref variables or Array.Copy() which currently isn't exposed.
I've written my own method. Is the below code safe to use with UdonSharp?
public void ShiftArrayLeft(int[] array, int shiftAmount) { if (shiftAmount <= 0) return; for (int i = shiftAmount; i < array.Length; i++) { array[i - shiftAmount] = array[i]; array[i] = 0; } }
That looks fine. For future reference, the issues page is not the place to go for support. Consider joining the Discord.
Ah yeah forgot about the Discord. I'll post there next time, thanks.
Hi, so I've encountered a programming exercise for shifting array elements left.
Current solutions on Stackoverflow involve ref variables or Array.Copy() which currently isn't exposed.
I've written my own method. Is the below code safe to use with UdonSharp?