You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using C# I wanted to have an interface that would ensure that anything implementing such interface would have a certain signal.
In my case IDamagable would have [Signal] public delegate void DamagedEventHandler and anything implementing such interface would have the Damaged signal. However that is not the case. I can access the Handler in the class as IDamagable.DamagedEventHandler but the Damaged method is not generated.
I feel like its sensible thing to want to demand (through interfaces) for things to have signals.
I would have done it thorough inheritance however my class already inherits from something thats not necessarily Damagable and C# doesn't allow multiple inheritance which the Interfaces are supposed to deal with.
Steps to reproduce
publicinterfaceIDamagable{[Signal]publicdelegatevoidDamagedEventHandler();}publicpartialclassUnit:/*...*/,IDamagable{publicoverridevoid_Ready(){Damaged+=()=>{};//CS0103: The name 'Damaged' does not exist in the current context IDamagable.Damaged+=()=>{};//CS0117: IDamagable does not contain definition for Damaged}}
Minimal reproduction project
Trivial
The text was updated successfully, but these errors were encountered:
I think this would be a nice improvement, it would require some changes to the source generator. As far as I know the team is currently in feature freeze for 4.2 but I'll have a crack at it the next few days.
Godot version
4.1.stable.mono
System information
Godot v4.1.stable.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU (NVIDIA; 31.0.15.3667) - 11th Gen Intel(R) Core(TM) i9-11900H @ 2.50GHz (16 Threads)
Issue description
Using C# I wanted to have an interface that would ensure that anything implementing such interface would have a certain signal.
In my case IDamagable would have
[Signal] public delegate void DamagedEventHandler
and anything implementing such interface would have theDamaged
signal. However that is not the case. I can access the Handler in the class asIDamagable.DamagedEventHandler
but the Damaged method is not generated.I feel like its sensible thing to want to demand (through interfaces) for things to have signals.
I would have done it thorough inheritance however my class already inherits from something thats not necessarily Damagable and C# doesn't allow multiple inheritance which the Interfaces are supposed to deal with.
Steps to reproduce
Minimal reproduction project
Trivial
The text was updated successfully, but these errors were encountered: