I was writing a script and, as always, noticed the error “The parameter “delta” is never used in the function “_physics_process()”. If this is intended, prefix it with an underscore: “_delta.” What is the point of this error? The engine tells you to add delta when creating a _physics_process() or , _process() not _delta. Why is this? To my knowledge, doing either of these will function the same way.
I don’t know if this is necessarily what it means, but I’m pretty sure you can actually use the term delta in the function code. If it doesn’t appear in the code, it seems to be deemed unnecessary and the program makes an error telling you to signify that. This is purely from observation, so I wouldn’t take it as fact.
Is it an error or is it a warning?
I like this warning message.
If I declare a function with parameters and for some reason I don’t use one of those parameters then I like the editor warning me that something might be wrong or unnecessary and I can check my logic.
In the case of eg. _process() you are overriding a function definition from whatever node/class you are extending so you are obliged to match it’s parameter structure hence *_*process(delta). If you don’t need to use use delta in your function then the editor will warn you of this possible mismatch. Changing the parameter name or using @warning_ignore(“unused_parameter”) will simply stop the editor nagging you, the code will happily run whether you change the name or not.
This is a warning, not an error. It just means if you don’t use a passed in variable, which can be very useful for not forgetting something.
The point is code style. GDScript has a convention where you put an underscore at the start of a function parameter name as a shorthand way to document the fact that you are intentionally ignoring a parameter. It’s for the benefit of people reading and maintaining your code in the future, which is most likely future you who has forgotten some of the details of your past decisions.
I use this ALL the time.
Mostly with RPC calls where the parameters aren’t used on the same instance (For example, the server sending the client’s new position).
Thank you to everyone for their answers. I now understand. I thought it was just there to be there, and had no purpose.