I can define several RPCs in unity and I can call them via the networkView component. But it seems that it gets the RPC called regardless where it is defined.

So I was wondering to know how do the scope of RPC works in Unity. Am I able to call whatever RPC in whatever script which share the same networkView? Or is there any other logic behind?

As a corollary: can I define a unique structured file gathering every RPC in my project?


1 Answer 1


Unity will invoke the RPC method on ALL methods with that name that appear in any of the game object's components.

Yes, you could do that, I personally wouldn't recommend it. It will add unneeded dependencies in your project, and pretty much destroys the point OOP.

Right now the RPC scope thing is really quite terrible. Imagine if you have an RPC method in a base class called A. Suppose classes B and C inherit from A. Now, if you attach scripts of both B and C to a single game object( not unrealistic ), RPC calls to methods in the base class simply won't work properly.

Fortunately, this seems to be getting fixed: https://www.youtube.com/watch?v=ywbdVTRe-aA

They seem to be sorting out the networking component of Unity. Hopefully we're not waiting too long.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .