Hey guys, i’m new to photon. I did some research and followed some tutorials but haven’t found a solution yet. Started prototyping my 2D sidescrolling arena shooter with pun, I’m stuck on the customization part. Can I use sprite library in unity for this? or some other solution that works well with my 2D character rigged with IK. It’ll be the prefab that I would spawn as a character in game. How to change skins of that prefab in a customization menu. It’s hard to understand because does the method I chose works. Any help or guide will be useful. Thanks in advance!
2 Answers
2So, you need to save player’s choices and apply them to prefab?
Use playerPrefs or custom room properties, or script attached to indestructible object with DontDestroyOnLoad() to save this choices. Then load game scene and network-instantiate prefab. Then apply changes to prefab using RPC.
As far as i know applying changes to a prefab will not be transferred over network when calling Photonnetwork.Instantiate. So @miha4406jp 's suggestion will not work as described. In general i’d suggest to not ever apply changes to a prefab itself but only to the instance of a prefab. Applying changes to a prefab itself will only lead to weird issues down the road as for example other players might also spawn this prefab and look like the main player or something.
I’d suggest to use part of his solution and save the chosen customization to player prefs. Something like an array of integers should be enough where every array entry is the ID of a skin for a part of the body.
Then send this array to all connected players to configure the players skin on each client seperatly.
Oh, well, i mean instance, of course. Sorry.
– miha4406jp