Don’t stop! Keep going. You haven’t found the problem yet. You’ll know you have finished debugging when you find the problem.
Sounds like you wrote a bug… and that means… time to start debugging!
By debugging you can find out exactly what your program is doing so you can fix it.
Use the above techniques to get the information you need in order to reason about what the problem is.
You can also use Debug.Log(...);
statements to find out if any of your code is even running. Don’t assume it is.
Once you understand what the problem is, you may begin to reason about a solution to the problem.
You don’t show a loop through any quantity of products, but if you are doing any kind of loop-with-delegate construct, keep this in mind:
Delegate / Action variable capture / value capture:
A very nice summary by Bunny83;
1 Like