- Home /
Question by
johnleonhart · Apr 19, 2017 at 01:19 PM ·
teleportteleporting
Help Cannot convert type 'PhotonPlayer' to 'UnityEngine.GameObject'
Dude I need help,,, I Think This COde work,, but that error Cannot "convert type 'PhotonPlayer' to 'UnityEngine.GameObject'"
here is the code:
if (this.inputLine.StartsWith("/tpto"))
{
PhotonPlayer player19 = PhotonPlayer.Find(Convert.ToInt32(this.inputLine.Remove(0, 5)));
{
((GameObject)PhotonNetwork.player).transform.position = ((GameObject)player19).transform.position;
}
}
Someone please help
Comment
Answer by SkaredCreations · Nov 14, 2018 at 03:47 PM
PhotonPlayer is not inheriting from neither GameObject nor MonoBehaviour, it's just an internal class of Photon framework to store the player's info (ID, Nickname, IsLocal, IsMasterClient, etc). To handle what you're trying to do you should store the list of players' avatar gameobjects when the player connects and instantiates its own character, and then do stuff with the objects on this list.
Your answer
![](https://koobas.hobune.stream/wayback/20220612120029im_/https://answers.unity.com/themes/thub/images/avi.jpg)