Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | The_Black_Chess_King |
Reference: Godot 3.1 Beta 1
Ported my project from 3.0 to 3.1 and bam, lots of errors, “Well let’s start fixing them.”, but the majority of the errors were:
“XYZ is declared but never used in the script.”
Okay, so what do I do them? I commonly used this type of scripting:
onready var FutureItem = "" #Store a var type string for future use
And later, another object would access the first one, and change the var.
func Collision():
OtherNode.FutureItem = "GRENADE"
I am having problems with my singletons, which creates a var, but in that script, it does not adds nothing to it, but other scripts access it and add values later on the game.
I am sure Godot is advancing, but I couldn’t understand the reason for this to be considered an error,
It is a bad idea to store variables for future use?
Thanks in advance for any help you can bring me,
I see messages like this sometimes. Are they actually errors, or just polite warnings? I don’t think it’s ever interfered with the running of a game. I always take them as a heads up, but nothing more than that.
i_love_godot | 2019-01-17 14:38
I digged deeper into the issue and found some related problems, there are the links below for the GitHub discussions, for now my solution was to disable these types of “unused data” debugging errors, while I understood that is good for performance sake, It does not work with my workflow, for now.
(You can find the options for debugging check at → Project settings → General → Debug → Gdscript)
“GDScript: warns that a class variable is unused while it actually is”
opened by Zylann
GDScript: warns that a class variable is unused while it actually is · Issue #23207 · godotengine/godot · GitHub
“The unused class variable warning appears even if variable used through autoload”
opened by Chaosus
The unused class variable warning appears even if variable used through autoload · Issue #22206 · godotengine/godot · GitHub
The_Black_Chess_King | 2019-01-17 14:41
@I_love_godot Well they show in the debug section like errors, but in my case it is growing project, and the errors bloated to more than 29, hiding and mixing with other errors in the debug window. Not good in my opinion. But yes, they don’t break the functionality of the scripts.
The_Black_Chess_King | 2019-01-17 14:43