Irrelevant errors?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Syl

Greets!

I often got these kind of yellow error when testin my projects:

‘The argument ‘body’ is never used in the function ‘_on_Area2D_body_entered’’.

They don’t seem to really affect them, are they?

:bust_in_silhouette: Reply From: Sersch

You can add an underscore in front of any argument (_body) to make these errors go away. As far as I know they don’t hurt, they’re just info.

You can also click on Project → Project Settings → Debug → GdScript and disable “Unused Argument” to disable these messages for your entire project.

Yes, you could also toggle them at the bottom of the script, but i’ll keep them and try to remove them in time.

Syl | 2020-01-25 07:45

:bust_in_silhouette: Reply From: Gold Card

If the errors are yellow you shouldn’t worry about them.

:bust_in_silhouette: Reply From: jgodfrey

I wouldn’t recommend that you blindly ignore warnings. They are there to indicate possible issues with your code. As long as you understand why a given warning is being issued, you can make an informed decision regarding whether it’s important to you or not.

The specific warning you mention is just telling you that your onArea2Dbodyentered function has an input argument (body, which is the body you collided with) that you’re not using in the function. That’s not really a problem if you don’t need it for anything. So, again, just understand the warnings and make appropriate decisions.

You can tune the various warnings issued by Godot in the Project Settings. Specifically Project Settings | Debug |GdScript. There you can disable all or specific warnings and errors, though I wouldn’t recommend you do that.

For details, see:

https://docs.godotengine.org/en/3.1/classes/class_projectsettings.html#class-projectsettings-property-debug-gdscript-warnings-enable

Additionally, you can disable specific warning/errors in a given source code file using a number of directives. Rather than going into the details, here’s a link to a relevant discussion:

https://www.reddit.com/r/godot/comments/ay176j/can_i_disable_certain_warnings/

I see, could a lot of them leads to big issues or slowed loading?

Syl | 2020-01-25 00:18

1 Like

hii…The yellow error message indicates that there’s unused code in your project, specifically an argument called body in the function _on_Area2D_body_entered . While it may not affect your project is functionality immediately, it is best to clean it up for better code .

2 Likes

Not really relevant, but it’s always best to clean it up anyways. Would definitely make debugging easier if you actually run into issues