Character skin changes over a network

Hi everyone
Im trying to have characters on a network change skins depending on the players choice. my character prefab has a SkinnedMeshRenderer in its children. I want to access it and change the material on it. and i want other players on the network to also see the new skin on that players character, and not on theirs too. Skins are chosen in the main menu and saved as a integer to playerprefs. I have provided my class below, and I would appreciate any help with this. I hope this makes sense, as Im not a native english speaker. Thanks :slight_smile:

using UnityEngine;
using System.Collections;

public class Instantiate : MonoBehaviour {
	
	public Material skin1;
	public Material skin2;
	public Material skin3;
	public Material skin4;

	public Transform playerAvatar;
	public NetworkView playerID;
	public string playerName = "";
	public int playerClass = 0;
	public int playerSkin = 0;
	public Transform PlayerCamera;
	public SkinnedMeshRenderer skinner;
	
	void Start () {
		playerName = PlayerPrefs.GetString("AvatarName", "");
		playerClass = PlayerPrefs.GetInt("AvatarClass", 0);
		playerSkin = PlayerPrefs.GetInt("AvatarSkin", 0);
	}

	void OnNetworkLoadedLevel () {
		// instantiate player when network is established
		if (Network.isClient) {
			Network.Instantiate(playerAvatar, transform.position, transform.rotation, 0);
			playerID = GameObject.Find("Player(Clone)").networkView;
			if(networkView.isMine) networkView.RPC("SetSkin", RPCMode.All, playerID, playerSkin);
		}
	}

	void OnPlayerDisconnected (NetworkPlayer player) {
		Network.RemoveRPCs(player, 0);
		Network.DestroyPlayerObjects(player);
	}
	
	void OnDisconnectedFromServer () {
		Destroy(GameObject.Find("Player(Clone)"));
		Network.RemoveRPCsInGroup(0);
	}
	
	[RPC]
	void SetSkin (NetworkView player, int skin) {
		skinner = player.gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
		if (skin == 0) {
			skinner.material = skin1;
		}
		if (skin == 1) {
			skinner.material = skin2;
		}
		if (skin == 2) {
			skinner.material = skin3;
		}
		if (skin == 3) {
			skinner.material = skin4;
		}
	}
}

Does no one have any insight?
I think the problem lies with

GameObject.Find("Player(Clone)")

so I think I need a better way to tell which player object the change should happen to when calling the networkview.RPC.

Please help here, I’m stuck with this and I want to do something similar with equipment, floating name, and animations. so I really have to understand how to use the player ID thing in calling a RPC

Over 100 views but no reply? Can someone please just explain to me how to reference the player sending the RPC character. what I’m doing with the find gameobject is not working. Is there some ID I can access? Can I then access that ID’s game object and components? Also how would I parent a network instanciated object to another one?

hat = Network.instanciate(hat1, some position, some rotation, 0);
hat.transform.parent = GameObject.Find("Player(Clone)").transform;

like that? seems to cause some errors. I’m sure all my porblems are related here with the sending of RPCs and the reference to the object it has to happen to.