The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to create a custom skin for each player

2017-02-11 18:51:18

Hi, I am new to Photon. I have a playerPrefab which is simply a game object with some scripts (but no skin).
I want to instantiate the player on all clients and then set the correct skin which is either a wizard skin prefab or a warrior skin prefab.
I use custom properties to set the skin name and that works.
On the player object, I have this piece of code:

void OnPhotonInstantiate( PhotonMessageInfo info )  
	Debug.LogError("Skin: " + info.sender.CustomProperties["Skin"]  );  
	if ( PhotonNetwork.isMasterClient )  
		GameObject skin = (GameObject)PhotonNetwork.Instantiate      (info.sender.CustomProperties["Skin"].ToString(),, Quaternion.identity, 0, null);  
		skin.transform.SetParent( transform, false );  
		skin.transform.localPosition =;  
		skin.transform.localRotation = Quaternion.identity;  

The result is as follows. There are 2 players. One has the warrior skin property and the other has the wizard skin property.
On MasterClient all is well. Each player has the correct skin, it is parented correctly and the rotation and position is correct.
On the remote client, one skin got create (let's say for warrior), in the centre of the world and it is not parented. The other skin (wizard) never got created.

What should I do to instantiate the skins, set their parents and position/rotation correctly on all clients?
Because I am a new, I would appreciate sample code if possible. Thanks for your help!


[Deleted User]
2017-02-13 13:59:55

Hi @Koran,

how many different skins are there in your game? You have given us an example with just two different skins. If there are no more additional skins, you can simply create two prefabs (one representing the warrior, the other representing the wizard) and instantiate one of them based on your 'role' in the game, e.g.:

public void OnJoinedRoom()  
    if (PhotonNetwork.isMasterClient)  
        PhotonNetwork.Instantiate("Warrior",, Quaternion.identity, 0);  
        PhotonNetwork.Instantiate("Wizard",, Quaternion.identity, 0);  

If there are more different 'characters', it might be good idea to have a unique prefab for each of them, since instantiation might be is easier than trying to 're-skin' the game objects.

2017-02-13 19:36:02

Hi Christian, thanks for your suggestion. However, I do have many different skins (much more than 2). In addition, I want to support accessories such as different staff, swords, etc. It becomes impossible to have a prefab for all possible permutations. Hence the idea of sending the skin/accessories via custom properties.
Still open to suggestions on how to solve this. Thanks!

[Deleted User]
2017-02-16 15:42:13

Hi @Koran,

the player's custom properties may be one option to go with. Another is the usage of RPCs since your characters already have a PhotonView component attached to them. For example this one:

pView.RPC("SwapWeapon", PhotonTargets.All, "Epic Sword");


public void SwapWeapon(string weaponName)  
    if (weaponName == "Epic Sword")  
        // Equip matching weapon  

Names can also be replaced by unique IDs making it maybe easier to deal with. This can be also applied to other components or properties of the characters, you just need something to address it as seen in the example above.

2018-01-23 14:22:49

Hi there!

I've the same question as @Koran. I've a game where it's possible to choice different accessories for your character, such as sunglasses, ties, hats... It's the same prefab, but with different Sprites in those objects.

I want to know how can i do to make everyone see those skins in the right player?

Thanks in advance!

Back to top