Alien Attack Player Movement question (delta vs _delta?)

Hi folks, nothing I’m questioning about code-wise but I’m curious about why I’d have a note (yellow indicator) appearing in Debugger regarding using (delta) in func_physics_process(delta) as below.

W 0:00:01:0349 The parameter ‘delta’ is never used in the function ‘_physics_process’. If this is intended, prefix it with an underscore: ‘_delta’


Not an issue, just curious why I’d get asked to use _delta instead of just delta since the auto complete gives the latter. Hope I made sense here?

1 Like

I’m assuming you are talking about Godot, here is what I found:

The note you are seeing in the Godot debugger regarding the use of delta in func _physics_process(delta) is just a suggestion or warning and not an error. The purpose of this warning is to let you know that the parameter delta is defined but not used within the function.

The naming convention suggested in the warning, using an underscore prefix for unused parameters like _delta, is a common convention in programming to indicate that a parameter is intentionally unused. By prefixing it with an underscore, you are signaling to other developers (and to the code analyzer) that the parameter is intentionally ignored and not meant to be used.

In the case of Godot’s _physics_process function, the delta parameter represents the time elapsed since the previous frame. It is provided as a convenience to perform frame-rate independent calculations. However, if you’re not using delta within your _physics_process function, you can safely ignore it or rename it to _delta to satisfy the warning. The choice between ignoring the parameter or renaming it is up to you and depends on your code’s specific needs.

It’s worth noting that Godot’s auto-complete suggestions may still show delta as a valid parameter because it is a commonly used name for the time delta in game development. However, the warning you are seeing suggests using _delta to follow the convention of marking unused parameters.

Hope this helped a bit!


This has helped out massively, thank you so much! Yeah I wasn’t too worried about the message, was just curious. :slight_smile:


Glad I could help, good luck with your future gamedev endeavors!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Dont know how i missed this one, think ive set up my search tags a little wonky :frowning:
(but i also see that theres no tag associated with the post, so ill get that added, just so others can find it easier)

nicely caught guys :slight_smile:

heres my understanding with relation to the whole underscore thing.

the uderscores in either a function name or variable are as mentioned, just really a convention and wont force an error, just warnings.

pretty much comes down to the idea of virtual methods for the first part.

with the likes or _process and _ready, these are base methods that are internally created and used by godot and are intended to be overrided / exended by a script if the programmer decides that they want some additional functionality from these methods, through the convention of having a leading underscore.

if we dont use any one of these virtual methods in our script, no biggie, godot will do what it does and use their base functionality which we dont have to worry about in our scripts.

so, this is now where the method arguments come into play.
since for example, _process and _physics_process are virtual methods, these methods have whats called a signature. the signature defines or declares how the method or function has to be used and what arguments it requires, if any.

with say the base class of _process as per the docs it shows this does require something

so its expecting an argument, so by default ‘delta’ is popped in there if we use it in our scripts rather than ommit it.

as was mentioned, the underscore has another couple of convention uses. again these are just convention and not enforced.

the warning that you were getting is just that, a warning, basically the engine telling you that its base _process method has an parameter it uses, but you arent using it at all. so its informing you, if your sure about not using it then pop a _ before the parameter and ill ignore the fact that your not using it then :slight_smile:

theres also the last convention that im aware of that uses the _ .

its the idea of private variables. now, godot doesnt have the understanding of public and private variables.
but as a convention, the _ can be used before variables, just to indicate or remind ourselves or others who read our code, that this variable is not intended to be used outwith this script it is declared in.

1 Like

Privacy & Terms