Open drearyweary opened 3 weeks ago
This is by design, Unused Variable
is for local variables, as the documentation says
Member variables can be unused as they could be:
It not being used in the same script is not an indication of anything being wrong, unlike a private variable which should be expected to be used in the same script, and a local variable which should be used locally
Feature proposals are tracked here, please open a proposal instead.
Thank you for the explanation. I won't make any proposal changes since this is the correct behavior.
Tested versions
Reproducible in Godot 4.3.stable
System information
macOS 13.6.7 (Intel) - Godot v4.3.stable - Vulkan (Mobile)
Issue description
In 3.5, the Unused Class Variable warning would trigger for unused public and private class member variables. Now in 4.x, this has been renamed to Unused Private Class Variable and only warns for private class variable.
Steps to reproduce
Turn on warning for Unused Private Class Variable and Unused Variable in Project Settings > Debug > GDScript. Then type in a new script:
I apologize if this change was made because unused public class variables are ok to have, but the previous warning was very useful to find class variables I forgot to remove. I am not familiar with other languages to know if this is the convention elsewhere.
Minimal reproduction project (MRP)
N/A