public void RegisterPhotonView(PhotonView netView)
{
if (!Application.isPlaying)
{
this.photonViewList = new Dictionary<int, PhotonView>();
return;
}
if (netView.viewID == 0)
{
// don't register views with ID 0 (not initialized). they register when a ID is assigned later on
Debug.Log("PhotonView register is ignored, because viewID is 0. No id assigned yet to: " + netView);
return;
}
if (this.photonViewList.ContainsKey(netView.viewID))
{
// if some other view is in the list already, we got a problem. it might be undestructible. print out error
if (netView != photonViewList[netView.viewID])
{
Debug.LogError(string.Format("PhotonView ID duplicate found: {0}. New: {1} old: {2}. Maybe one wasn't destroyed on scene load?! Check for 'DontDestroyOnLoad'. Destroying old entry, adding new.", netView.viewID, netView, photonViewList[netView.viewID]));
}
else
{
return;
}
this.RemoveInstantiatedGO(photonViewList[netView.viewID].gameObject, true);
}
// Debug.Log("adding view to known list: " + netView);
this.photonViewList.Add(netView.viewID, netView);
//Debug.LogError("view being added. " + netView); // Exit Games internal log
if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
{
Debug.Log("Registered PhotonView: " + netView.viewID);
}
}