How do I add components to the PhotonView ObservedComponents list on runtime?
For my game, I need to dynamically add and remove transform syncs.
So far it works, but I always get a NullReference error when I try to add my transform sync to the list.
This is my code:
PhotonView RPV = remoteObject.AddComponent();
PhotonTransformView PTV = remoteObject.AddComponent();
PTV.m_PositionModel.SynchronizeEnabled = true;
PTV.m_RotationModel.SynchronizeEnabled = true;
RPV.ObservedComponents.Add(PTV);
Any ideas?
So far it works, but I always get a NullReference error when I try to add my transform sync to the list.
This is my code:
PhotonView RPV = remoteObject.AddComponent();
PhotonTransformView PTV = remoteObject.AddComponent();
PTV.m_PositionModel.SynchronizeEnabled = true;
PTV.m_RotationModel.SynchronizeEnabled = true;
RPV.ObservedComponents.Add(PTV);
Any ideas?
0
Comments
-
Fixed:
I didn't initialize the List.0 -
How to did you make a list???
0