Skip to content

CollisionObject2D param type mismatch between _InputEvent method and InputEvent delegate #93912

Open
@beraligatr

Description

Tested versions

Reproduceable in v4.2.1.stable.mono.official [b09f793]

System information

Godot v4.2.1.stable.mono - Windows 10.0.22631 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3070 (NVIDIA; 31.0.15.5152) - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 Threads)

Issue description

For CollisionObject2D, _InputEvent accepts a Viewport as the first parameter, while the signal/delegate InputEvent accepts Node as the first parameter. Both seem to do the same thing, and the other params are the same. Node param for InputEvent is also labelled viewport.

So I'm wondering if this was a mistake or if there was a reason that the input event signal may send a Node instead of a Viewport?

Steps to reproduce

using Godot;
using System;

public partial class ExampleCollisionObject2D : Area2D {

  public override void _Ready() {
    base._Ready();

    InputEvent += (Viewport viewport, InputEvent @event, int shapeIdx) => {}; // This throws an error
  }
  
  // This is fine
  public override void _InputEvent(Viewport viewport, InputEvent @event, int shapeIdx) {
    base._InputEvent(viewport, @event, shapeIdx);
  }
}

Minimal reproduction project (MRP)

N/A - this is C# specific.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions