"Invalid Cast" On Deserializing PhotonTransformView last Photon 2.14

Options


I am getting the following error since updating to the last version 2.14

https://forum.unity.com/attachments/upload_2019-8-27_21-13-52-png.474512/

InvalidCastException: Specified cast is not valid

at PhotonTransformView.cs: 93

I tried debugging since it seems it is receiving some strange data from whoever is controlling the object in question, and debugging the stream.ReceiveNext(); that is supposed to set this.m_Direction, I saw a Vector4 instead of a vector3 which is what causes the invalid cast and freaks out about it. I am not sure why this is happening though.

I also changed my transformviews to the tranformviewclassic ones and I get the same error, this time it is localized to the rotation (OnPhotonSerializeView of the m_RotationControl), I get a cast invalid to a quaternion and if I debug it i see that is is because I am getting a Vector3 (0,0,0) from the stream instead of a quaternion. The photonviews are unreliable on change,and it happens only at the beginning of starting the change, in case that helps.

UPDATE: I just regressed to Photon 2.10 to test and it solved the issue ( I couldn't find the 2.12 package which was the one I was using before updating), so it must be something in the new version : /


LAST UPDATE: I found a rogue script that was doing transformView.m_SynchronizePosition = false; for one of the observed components for a couple of frames before reactivating it, this must be the source of all since it fixed the errors. I don't understand very well why it makes the stream of data fail but it is sensible that it could happen. I refactored it to fix it and now everything is good.



Comments

  • Alex_H
    Alex_H
    edited August 2019
    Options
    Some more info on this case:

    I didnt modify transformview or transformviewclassic and it keeps hapenning. As for other objects being observed, I am observing several transformviews in one photonview that is parent to all of them. So one parent observes all the children transformviews (to save on messages), maybe this is the problem but it was working just fine before updating. I will try later to set up a minimal case.

    After more testing it keeps happening when starting a change. I am using the transformview to sync changes in position and scale simultaneously (i am scaling manually from a different pivot so position and scale change at the same time, I also track rotation but at different times/input). It is set as unreliable on change because it doesnt change often only at the users input. So everytime the changes start this error pops up and data seems to get mingled.

    UPDATE: I just regressed to Photon 2.10 to test and it solved the issue ( I couldn't find the 2.12 package which was the one I was using before updating), so it must be something in the new version : /

    UPDATE 2: Actually after playing a bunch with it I have seen that error appear but it happens very rarely now, again same situation, on start of changes(but not always just sometimes), with a photon view observing several transform views...it used to block my vr headset before but it doesn't now which is probably why I never noticed with old versions. To give you some indication of how, I used to get dozens and dozens of the error and now I am getting it 2 or 3 times only. It also seems more pronounced with transformview than with transformviewclassic
  • TyrokaFX
    Options
    I have the same problem
  • jeanfabre
    Options
    Hi,

    We are not aware of any issues with this, would have a repro case, can you boil it down to a minimal scene, if we can repro the problem, we can look at it, else, we'll need more details.

    Bye,

    Jean