BAD GLITCH every time i launch my game.
Options
Hey, so I have players connect to a lobby room and then go into the main level. In the main level, I spawn the player and their sprite separately (because of skin stuff). But when I open the game and connect two players, I keep getting this error and movement is not replicated.
InvalidCastException: Specified cast is not valid.
Photon.Pun.PhotonNetwork.AlmostEquals (System.Object one, System.Object two) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2008)
Photon.Pun.PhotonNetwork.DeltaCompressionWrite (System.Collections.Generic.List`1[T] previousContent, System.Collections.Generic.List`1[T] currentContent) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1856)
PLEASE HELP!
InvalidCastException: Specified cast is not valid.
Photon.Pun.PhotonNetwork.AlmostEquals (System.Object one, System.Object two) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2008)
Photon.Pun.PhotonNetwork.DeltaCompressionWrite (System.Collections.Generic.List`1[T] previousContent, System.Collections.Generic.List`1[T] currentContent) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1856)
PLEASE HELP!
0
Comments
-
"InvalidCastException: Specified cast is not valid.InvalidCastException: Specified cast is not valid."
If I'm understanding this correctly, the engine is trying to cast (convert) one data type to another, but failing.
Are you sending by RPC or stream any values that are somehow mismatched in type? (e.g. int vs. string)1 -
Yes, I am sending a string to set player names. I think that is the issue but idk how to fix it.0
-
Heres the code for the RPC, this is called every late update because I have score updated as well:
[PunRPC]
public void setMyName()
{
myName.GetComponent<PhotonView>().RPC("setNetworkName", RpcTarget.All, PlayerInfo.playerName + ": " + gems);
}
PlayerInfo is all the save data and playerName is a string.
[PunRPC]
public void setNetworkName(string playerName)
{
textName.text = playerName;
}
and there is the void being called0 -
PlayerInfo.playerName + ": " + gems
0 -
Sorry for the late response, holidays and stuff, I fixed it by predefining it in a string variable so yeah Thank you for all your help and have a lovely rest of your day
0 -
ok nvm it now won't set any ui text.0
-
i set it to go to string as well so idk what the issue is0