Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

How do I add components to the PhotonView ObservedComponents list on runtime?

$
0
0
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?

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>