0 votes

I'm looking for an area_entered equivalent in C#

https://docs.godotengine.org/en/3.1/classes/class_area2d.html#class-area2d

like

func _on_Area2D_body_enter(other):
           print(other.get_name())

in C#

in Engine by (15 points)

1 Answer

+1 vote
Best answer

area_enteredis a signal. Signals can be connected to any function. If you use the editor to automatically create a receiving function, it will follow the scheme _on_nodeName_signal_name(). Otherwise you can create the function like any other C# function and connect the signal to it either via the editor or in code.

public void OnArea2DAreaEntered(Area2D area)
{
    // your code here
}

See the Signals tutorial for details.

by (19,649 points)
selected by

enter image description here

enter image description here

Great! Thanks!

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.