Does it implement this interface?
Sometimes when using Unity, you need to know, in realtime, if your object has implemented such interface, here is a function that can help.
static public T HasImplementedInterface
{
return o.GetComponents
}
if you don't want to use RTT System.linq, you can do it even easier:
//imagine an interface called ICarPanel
ICarPanel cp = obj as ICarPanel;
if (cp!=null)
Debug.Log("Implements ICarPanel");
:) !
No comments:
Post a Comment