0

I am working on a co-op game using photon unity, I am using parenting to move my object with respect to other, when I am setting my object parents to null one more copy is being created and being left on its parent object or you can say perviously parent object on sometimes on master's or clients or on both screen.

Players are getting Instantiated locally and all code is being synced using RPCs

void OnCollisionStay(Collision Coll)
{
    if(Coll.collider.tag == "Plank")
    {
        transform.parent = Coll.transform;
    }
}

void OnCollisionExit(Collision Coll)
{
    if(Coll.collider.tag == "Plank")
    {
        Coll.gameObject.GetComponentInChildren<Animation>().Play();
        transform.parent = null;

    }
}

1 Answers1

0

Most likely it is an ownership issue. In brief - you are allowed to modify transform of photon object only on a client who instantiated it. And if you want to modify transform of a said object on another client, then you have to transfer ownership to that client.