Can i call RPC functions outside of MonoBehaviour?

I’d like an implemented interface to call upon RPC functions, is that possible?
ie I have a GameManager with a state machine which switches IPlayerInterface from IStartMenu to IGameLobby to…
I’d like to handle the RPC’s in the Children of IPlayerInterface instead of flooding my GameManager with all RPC functions for the game…

I know i need a networkview attached to call RPC’s but is there some way i can start the call from the current implemented IPlayerInterface…?

They have to be methods on a MonoBehaviour attached to the GameObject with the networkView. Unity can’t find them otherwise.

That being said - you don’t have to put them all in a single file.

yes i was hoping i could implement then through inheritance… to bad :frowning:

AFAIK this works

public class A : MonoBehaviour
{
    [RPC]
    public virtual void Do() { }
}

public class B : A
{
    [RPC]
    public override void Do() { base.Do(); }
}

ah yes like that would work… problem is i was trying it with an interface.