How to remove Photon Transform View component in Unity
Hi,
I need to remove PhotonTransformView and PhotonView components in Unity, so that object will not be synchronized any more. I did that with Destroy(item.GetComponent<PhotonTransformView>());. The component is removed and the same for PhotonView. The problem is, that when I remove this components, I get this error every update : "MissingReferenceException: The object of type 'PhotonView' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.". So I expect I need to do the opposite of AllocateViewID, but I don't know how or if that's even possible.
Thanks!
I need to remove PhotonTransformView and PhotonView components in Unity, so that object will not be synchronized any more. I did that with Destroy(item.GetComponent<PhotonTransformView>());. The component is removed and the same for PhotonView. The problem is, that when I remove this components, I get this error every update : "MissingReferenceException: The object of type 'PhotonView' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.". So I expect I need to do the opposite of AllocateViewID, but I don't know how or if that's even possible.
Thanks!
0
Answers
-
Have you tried PhotonNetwork.Destroy()? I think you need to send an rpc to destroy that object on the other side0
-
Hi,
So I tried what you said, but the problem is, that in that case the whole object gets deleted. Instead, I want just for PhotonTransformView and PhotonView to be deleted. Is there any way of doing this?
Thanks!1 -
Looking for the same thing here, anyone could provide an answer ?
0