Can PunRpc be passed from parent gameobject to child
The whole answer can be found below.
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).
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
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
}
}
You can use photonView of parent GameObject now.
Back to top