Transform.parent via RPC
I want to edit the transform.parent with a RPC, but i get this:
Exception: Write failed. Custom type not found: UnityEngine.GameObject
ExitGames.Client.Photon.Protocol18.WriteCustomType (ExitGames.Client.Photon.StreamBuffer stream, System.Object value, System.Boolean writeType)
This is my code:
[PunRPC]
void pickup(GameObject a)
{
a.transform.parent = held;
a.transform.localPosition = Vector3.zero;
}
Exception: Write failed. Custom type not found: UnityEngine.GameObject
ExitGames.Client.Photon.Protocol18.WriteCustomType (ExitGames.Client.Photon.StreamBuffer stream, System.Object value, System.Boolean writeType)
This is my code:
[PunRPC]
void pickup(GameObject a)
{
a.transform.parent = held;
a.transform.localPosition = Vector3.zero;
}
0
Comments
-
GameObject is not a Type we can serialize.
But: The RPC itself is already targeting a specific object. So you can just call it and only this object changes.0