This is only a very small portion of the code in this script.
I keep getting the warning that the variable “brick” is assigned but never used. If i delete the variable, of course, I get an error that says "the name brick does not exist in the current context.
It can’t be that I have assigned the variable and simultaneously not assigned it!
Anyone know the answer to this? it’s a bit annoying. I’m close to finishing up my game and want to clear out all the warning but this one is stubborn.
You get the warning because, based on that code, even though your are assigning brick a value with “brick = GameObject.FindObjectOfType”, you are not actually using it. Using it would be calling a method in Brick, getting data from a field/property, equating it to something, etc. This warning is only to notify you that the variable isn’t used for anything, and could be removed.
Yeah, this was a big “Derp!” moment for me today. I set that variable and used it and then decided to go back and take a different approach. I guess I forgot all about deleting all of it and then today I did not look any further before I posted this silly question. sigh…