Exception: Cannot Serialize(): UnityEngine.GameObject

so I really need all the players to save a GameObject in their lists

private void OnTriggerEnter2D(Collider2D other)
{
PV.RPC("ontriggerenter",PhotonTargets.AllBufferedViaServer, other.gameObject);
}
[PunRPC]
public void ontriggerenter(GameObject obj)
{
var script = obj.GetComponent<AiMovement>();
if (script.Owner == Owner)
return;
Enemies.Add(obj);
}

as this is neccesary i can't just take out something from it. I NEED THE SPECIFIC GAMEOBJECT! PLEASE HELP MEEEEEEEE I'M LOSING MA GOD DAMN MIIIIIIIIIIIIIIIIND

Answers

  • Hi @DaTweaks,

    Thank you for choosing Photon!

    Photon does not support Unity's GameObject as a serializable type. See here for the list of supported types.

    I think for this use case you can PhotonViews on objects that collide.
Sign In or Register to comment.