If this is your only method, then how are you obtaining the values `ore`.
The problem may lie within the structure of your code, here are some improvements that I can think of:
Note: This has not been tested, so may not work 100%, but some things I did was adding the line GameObject ore =...