Interface Type

From Resonite Wiki
Revision as of 17:49, 9 February 2024 by 989onan (talk | contribs) (fix link)

Interface types are reference types that don't refer to a specific component, but a C# Interface that can be implemented by one or multiple component classes. Interfaces are used to describe a specific common behavior that similar classed may want to implement. Because clases that implement a specific interface are required to implement the methods and properties defined in that interface, they can all be assigned to a variable of the interface type, making them very userful within Resonite.

In C# it is convention to start interface class names with the capital letter 'I'.

Example

An example of an interface type used within Resonite is IButton. It is implemented by multiple button-like components like Button, PhysicalButton and TouchButton. All of those components implement the behavior of a button that can be pressed as defined in IButton. Because of this, you can use either of them as a valid reference to plug into the "Button" input of the Button Events ProtoFlux node, which requires a global of type IButton.