The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Can PunRpc be passed from parent gameobject to child

dreadlocks
2016-08-28 20:07:09

Hello,

I have a gameObject that has PhotonView attached, then I have other child objects connected to that parent.

Those child objects need to communicate over the network using RPC. But it seems with photon, only the parent object that has the PhotonView attached can communicate, and not any of the children.

Is there a way I can forward the RPC from the parent to the child objects, without writing individual functions in the parent to call the child functions manually?

I know in uLink networking I can specify that RPC can be called to/from any child object, but seems that cant work in photon.

Thanks

Comments

Mir
2016-09-13 22:03:24

if your gameobject parent A-child B structure,
add Script A class to A, B class To B, and make B inherit A.
Now Class B is child of class A

class A : monobehavior {
PhotonView photonViewA;
}
class B : class A {
PhotonView photonViewB;
void Awake()
{
photonViewB=GetComponent().photonViewA;
}
}

You can use photonView of parent GameObject now.

Back to top