public void AddPlayer(CharacterInfo p) { GameObject obj = Instantiate(PlayerPrefeb, GameObject.Find("Characters").transform); Player player = obj.GetComponent <Player>(); SetCharacterInfo(player, p); obj.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Characters/" + player.Info.Image.Replace("\"", "")); MainPlayer = player; NetPlayers.Add(obj); }
public void AddNetPlayer(CharacterInfo np) { GameObject obj = Instantiate(NetPlayerPrefeb, GameObject.Find("Characters").transform); print("x = " + obj.transform.position.x + "y = " + obj.transform.position.y); NetPlayer netPlayer = obj.GetComponent <NetPlayer>(); SetCharacterInfo(netPlayer, np); obj.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Characters/" + netPlayer.Info.Image.Replace("\"", "")); NetPlayers.Add(obj); }