How do I add a PhotonTransformView after I have instantiated an object?

Hello! I am using a library called Unity Multipurpose Avatar which destroys and creates a new skinned mesh renderer for my character after my player is instantiated. I tried adding a PhotonTransformView after this character is instantiated, however it is giving me errors and I cannot see the PhotonTransformView on the other players in the scene. Is there a way to fix this so I can see the new renderer?

Answers

  • If it just replaces the Renderer, your original PhotonView and PhotonTransformView should still be in placer, no?

    (I closed the duplicate thread in the DotNet category)

  • Thanks for that! This is my first time posting on the forum so I didn't realize I was posting under a different category. It actually has a separate object with the renderer on it called UMARenderer and that whole object is destroyed and recreated when a script called UMAData which holds the information of the character DNA is altered. The UMA data script is also not updated across the network and I am not sure how to fix this either. One thing that I figured out could make it work is an RPC for the function that updates the DNA, however I would have to use a Buffered RPC to tell other players what has happened when they join the room and I feel like this might get wonky whenever the player the buffered RPC was called on leaves the room. Is there another way that I would be able to do this?

  • Character customization is usually a good fit for Custom Player Properties. Those are synced to joining player and existing ones alike. When they change, there is a callback and you could update characters.

  • Thanks for the info Tobias! From what I've seen, the OnPlayerPropertiesUpdate is only called for player already in the room right? So if a new player joined, they would not be able to see the changes made to a GameObject made by this call right? And then for roomProperties, I thought about making it so there would be roomProperties which hold the recipe for each actor, but then I think a new player would have to load the recipe for every actor when they enter a room, which seems like it would just have the same runtime as the bufferedRPCs. Is there any way to get it so the changes made to these objects are automatically synced over the network so when the player loads into the room they are already there? (Again, seems like a photonView would be best here but the object rendering the player is destroyed and recreated when the custom recipe is loaded)

  • So if a new player joined, they would not be able to see the changes made to a GameObject made by this call right?

    The properties of the room and all players are sent to joining players. When they get their OnJoinedRoom() callback, the properties are there and can (should) be used. They don't get the "changed" even but .. it's implied that these "change" on join.