Usin signal InputEvent with csharp not working

Godot Version

Question

Hi there, I don`t understand why I have an error with this signal…
with gdscript works fine:

extends RigidBody3D

func _ready():
connect(“mouse_entered”, OnMouse)
connect(“input_event”, OnEvent)

func OnMouse():
pass

func OnEvent(cam:Node, event:InputEvent, position:Vector3, normal:Vector3, shape_idx:int):
pass

but no in csharp, my guess is that the class InputEvent has the same name than the signal??

public partial class Dice3D : RigidBody3D
{

public override void _Ready()
{
MouseEntered+=OnMouse; //this works ok
InputEvent+=OnEvent; //this is an error
}

public void OnMouse(){
//code
}

public void OnEvent(Node cam, InputEvent myEvent, Vector3 position, Vector3 normal, int shape_idx){
    //code
}

}

Any idea?

Thanks

Does it work with long instead of int?

That’s was the problem, fantastic thanks, but I can’t understand why this should be different with gdscript…

Thanks a lot again

1 Like

Int in gdscript is 64 bits, it’s a bit unclear in the docs :slight_smile:

See here

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.