0 votes

The following code will cause a yellow error.

func _process(delta):
    if Input.is_action_pressed("ui_cancel"):
        get_tree().quit()

The following yellow error is displayed:

The argument 'delta' is never used in the function '_process'

Is there a way to prevent errors from occurring in the function '_process' without using 'delta'?

(v.3.1.beta10.official)

in Engine by (40 points)

2 Answers

+2 votes
Best answer

Use

_delta

instead of delta.

Example:


func process(delta):

When you're sure you're not using delta.

I got this from this github issue ticket.

by (91 points)
selected by

I tried the following code using "_delta".

func _process(_delta):
    if Input.is_action_pressed("ui_cancel"):
        get_tree().quit()

I confirmed that the yellow error was not displayed.
The way Jagc taught me is simple, useful and great!
Thank you so much, Jagc! XD

0 votes

You can click onto warning button at bottom left of script edior
enter image description here
then click ignore that warning
enter image description here
the warning will not appear anymore
enter image description here

by (312 points)

In earlier versions, I also recognize that a warning button appeared at the bottom of script edior.
However, now I tried it with "v3.1.beta.official", but it did not come out.

According to your advice, putting the following comment will not cause an error.

#warning-ignore: unused_argument

Your advice has solved the problem!
Thanks to uploading the image, it's easy to understand.
Thank you so much, TyTYctA! XD

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.