0 votes

is there any other usage?

regarding guidisableinput,i think it can use when i pause the viewport.
extends Node2D

var toggle:bool

func _ready():
    get_tree().get_root().gui_disable_input = true

func _input(event):
    if Input.is_action_pressed("pause"):

func _pp():
in Engine by (186 points)

What's the question here? "Any other usage" other than what? That you can disable the reception of input events in a viewport doesn't make _input useless in any way.

1 Answer

0 votes

The _input(event) function is called by godot everytime you press a key.

for example, if you press the up arrow key, godot will call the _input function and specifies which input with the event variable. (the event value will be a string that you set in the project settings)

by (439 points)

thanks for comment.for example,what is difference func _process(delta) loop?
which is can operate character movement.

func _process(delta):
    if input.is_key_pressed(key_a)

you can choose any of them. both work very well!

i can not understand which is difference.is there any advantage to using input loop ,not a process loop?

there is basically no advantage. they are both the same.

thanks.yes i understand about this.just in case,i use input loop for key event.

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.