How to sync gameobjects for player who joined late?

Options
Hi,
I am making a drawing game that has multiplayer and open join room.
When Person A and Person B starts the game together, Person B can see what Person A draws. When Person C joins in late, Person C cannot see what Person A draw prior to Person C joining the game.

(Person C can see what Person A and B draw after Person C joined though)

I created the drawing function using Trail Renderer then bakes the Trail Renderer into a mesh.

I was trying to store the mesh created on a List array and pass it on to the other users but since it is not an "object", Photon was giving out an error. ( I used RaiseEvent and photonView.RPC() to no avail).

Any help would be greatly appreciated!

Thank you!

Comments

  • jRocket
    jRocket
    edited July 2019
    Options
    Don't try to sync a mesh. Just sent the points in a List<Vector3> instead. That will work with your RPC and on the receiving clients, you can re-create the trail renderer with your list of verticies, and bake it to a mesh.

  • lexmarkbites
    Options
    > @jRocket said:
    > Don't try to sync a mesh. Just sent the points in a List instead. That will work with your RPC and on the receiving clients, you can re-create the trail renderer with your list of verticies, and bake it to a mesh.

    Hi jRocket thanks for the response. What do you mean by points? Do you mean the trailRenderer.getPositions function?

    How do I assign the vertices to the the trail renderer? By trailRenderer.AddPositions?

    Thanks!
  • jRocket
    Options
    I would use GetPositions() and SetPositions() in the trailrenderer