Accessing a script as an interface (C#)

Godot v4.4 mono

i’ve been trying to access a script that is attached to a object that have been hit by raycast , i’ve tried GetCollider().GetScript() function but it returns a variant and i didn’t found a way to cast it as an interface

You can simply do this:

And if you need that casted into that object directly, you can simply add it as such:

1 Like