Specified cast is not valid. error

Hello,

I have two players in my room, I can see the host/first player move around from the second player, but the second player doesn't move for the host/first player. The host gets the error:

InvalidCastException: Specified cast is not valid.
at: PunAnimationMonitor line 221

What could I have setup wrong?

Thanks!
 
Does the demo scene work correctly? Are you using the latest version of all of the assets?
 
It doesn't happen in the demo scene. Does the error sound like it's coming from the scene or the character?

I just wanted to confirm that I can use the same UCC+Pun enabled characters for both the local player and the remote players? (It looks like it disables the locomotion scripts for the remote players, should the Pun Look Source be enabled on the remote player?)

Sometimes, I get a couple of other error messages from KinematicObjectManager.cs originating from line 854:
Invalid parameter pos in Rigidbody.WritePose because it was infinity or NaN
Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "TPMaleA (17) PUN(Clone)/ROOT/TP/TP Pelvis/TP Spine/TP Spine1/TP Spine2/TP L Clavicle/TP L UpperArm"

Sometimes the host can see the guest move and doesn't get the "specified cast..." error while the guest does get the error and can't see the host move. Other times, it's the exact opposite, the guest can see the host move but the guest is never spawned in the host's instance. (And the host still gets the "specified cast..." error.)
 
Last edited:
The PunAnimatorMonitor is coning from the character. As a test I would try using the included demo character just to see if you can get things working within your own scene.
 
Thanks for the help, it looks like it was caused by a bug that was injecting the wrong character for the guest or host occasionally which made it occur randomly.
 
One more update to this, it was because when the character wasn't found in the ucc+pun character stack, it was sending a non-ucc enabled character so it was throwing errors when being returned from the spawner.
 
Top