|Topic was automatically imported from the old Question2Answer platform.
In a BornCG tutorial on Youtube I have an issue with the coin vanishing when playing the game. If I comment out the coin script the coin is visible when playing, but disappears with the function active. At first a void statement had automatically appeared in the func line, but deleting that hasn’t solved the problem.
An error message for the coin script said (UNUSED_ARGUMENT):The argument ‘body’ is never used in the function ‘_on_coin_body_entered’. If this is intended, prefix it with an underscore: ‘_body’. This is Line 4 func _on_coin_body_entered(body):
Can any help me with this? I have gone back over what was done, but problem remains.
Hi… I tried moving the coin and could then see it in game so it was something to do with the tiles that were supposed to be ‘behind’ the coin. I am not sure why that happened which someone may wish to comment on.
An error message for the coin script said […]
First of all that’s not an error, but a warning. While you never should ignore an error, you can ignore a warning if you think it doesn’t apply in your specific case. Which of course requires you to understand what the warning is about!
In this case, the warning is supposed to tell you that
on_coin_body_entered expects an argument called
body even though you never use that argument. That might be because you simply forgot that (in which case you know what to do) or because you never wanted to do so in the first place. For methods you defined yourself, the latter would usually result in you removing the required argument from the defintion. But in this case the method is defined by the engine and you cannot do that! So the warning offers you a way out of this: prefix the argument with an underscore (
_body instead of
body) and Godot will stop complaining about that particular line.
Unfortunately that won’t fix your actual problem though. But as you haven’t provided us with the coin script, there is not much I can help you with other than the warning.