I've been working on this problem for weeks now, thought I had it a few times but I keep discovering new issues.
I need the player to be able to switch to a designated prefab when they press a button when inside a trigger.
The greatest problem I'm facing is that in a PUN 2 situation, simply calling a PhotonNetwork.Destroy on the old one and a PhotonNetwork.Instantiate on for the new one does not keep everything in sync over the network. Locally it works great!
I have even tried this by updating the PhotonViewID and Owner+Controller to be the same as it was before, but the result is that other players witness the Destroy and the Instantiate, but nothing more. Everything beyond that no longer syncs - transform, movement... - the new character remains in place where it instantiated regardless of what the player does.
I'm looking for the simplest way to achieve this, and have looked in to:
1. Piggybacking the Respawn system, though this seems to only return the current prefab to it's original state, I can't find a way to modify and respawn with a different prefab.
2. SpawnObjectsOnDeath - though this doesn't improve my above problem of syncs
3. Using SpawnManagerBase to Spawn a new character for the Local Player, though the script is very heavy and I'm looking for guidance on which parts I need to utilise in a new function to make sure this is properly broadcast across network, and caters for future joining players ie. buffered data.
4. Somehow transferring all component required over to NewObject, OR adding/replacing components on the current object? My main concern here is that the skeleton is different, I'm not sure how it would work. Inventory/Item Sets etc. will also be different.
I'm quite happy to manually update each and every property/variable whenever this occurs, I'm just not sure which need to be done to achieve synch when this new prefab arrives in to the scene.
Any guidance on the 'cleanest' way to achieve this would be fantastic!
I need the player to be able to switch to a designated prefab when they press a button when inside a trigger.
The greatest problem I'm facing is that in a PUN 2 situation, simply calling a PhotonNetwork.Destroy on the old one and a PhotonNetwork.Instantiate on for the new one does not keep everything in sync over the network. Locally it works great!
I have even tried this by updating the PhotonViewID and Owner+Controller to be the same as it was before, but the result is that other players witness the Destroy and the Instantiate, but nothing more. Everything beyond that no longer syncs - transform, movement... - the new character remains in place where it instantiated regardless of what the player does.
I'm looking for the simplest way to achieve this, and have looked in to:
1. Piggybacking the Respawn system, though this seems to only return the current prefab to it's original state, I can't find a way to modify and respawn with a different prefab.
2. SpawnObjectsOnDeath - though this doesn't improve my above problem of syncs
3. Using SpawnManagerBase to Spawn a new character for the Local Player, though the script is very heavy and I'm looking for guidance on which parts I need to utilise in a new function to make sure this is properly broadcast across network, and caters for future joining players ie. buffered data.
4. Somehow transferring all component required over to NewObject, OR adding/replacing components on the current object? My main concern here is that the skeleton is different, I'm not sure how it would work. Inventory/Item Sets etc. will also be different.
I'm quite happy to manually update each and every property/variable whenever this occurs, I'm just not sure which need to be done to achieve synch when this new prefab arrives in to the scene.
Any guidance on the 'cleanest' way to achieve this would be fantastic!