Question by
StarStorms21 · Nov 23, 2019 at 01:44 PM ·
c#interface
Is it possible to pass a Script that contains a specific interface?
So im building some sort of tower defense game where the turrets connect to observers that spot out the enemies. I want to have all objects that can be connected with each other to implement an interface (in this case IConnectable). My code looks like this:
public interface IConnectable
{
bool connectTo(IConnectable other);
bool breakConnectionWith(IConnectable other);
}
I want to pass a script or 'Type' in instead of an interface, maybe something like:
public interface IConnectable
{
bool connectTo(Type other as IConnectable);
}
How would I go about doing this?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612215212im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is it possible to change CustomPass variables via other script? 0 Answers
'Node' does not implement interface member 'interfaceNameHere' 1 Answer
Need help understanding a few c# concepts 1 Answer
C# - Error " does not implement interface member" 2 Answers
What is a good way to create dynamic dropdown buttons? 0 Answers