This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

Hi,

I am trying to connect a signal of a InputEvent to a function in my C# code:

inst.GetNode<Area2D>("Area2D").InputEvent += tileclicked;

public void tileclicked(Viewport viewport, InputEvent @event, int shapeIdx)
{
    GD.Print("Test");
}

inst is a Node2D to which is attached a Area2D.When building I get the following warning:

No overload for 'tileclicked' matches delegate CollisionObject2D.InputEventEventHandler'

How do I proceed to connect the signal to a function and get all of the parameters ?

Thanks

Godot version 4.0 RC1
in Engine by (36 points)

1 Answer

0 votes

Not sure if you've sorted this or not but for anyone who has this problem too like I did then the shapeIdx parameter needs to be long, not int.

The delegate is defined like this: public delegate void InputEventEventHandler(Node viewport, InputEvent @event, long shapeIdx);

by (14 points)
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 Frequently asked questions and 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 [email protected] with your username.