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#

asked Sep 24, 2019 in Engine by Memorix101 (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.

answered Sep 24, 2019 by kidscancode (17,004 points)
selected Sep 25, 2019 by Memorix101

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.