- Home /
Character Customization in Pun 2
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!
Answer by miha4406jp · Oct 07, 2021 at 02:37 AM
So, 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.
Answer by Captain_Pineapple · Oct 07, 2021 at 08:45 AM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613043916im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do you make teams in a multiplayer game? 1 Answer
Need script to do something when animation finished ? 1 Answer
Rigidbody2D jitter on collision. Photon Pun 2 sync issue? 1 Answer
In Photon how to execute queue messeges (RPC buffer) before spawning player into room ? 0 Answers
How do you add a timed animation 1 Answer