public bool Replace(Camera inCamera, bool inbSync) { if (!ReferenceEquals(inCamera, Camera)) { Camera = inCamera; if (inCamera != null) { m_Tracker = TrackedCamera.Get(Camera); if (inbSync) { UpdateVersion.Sync(m_Tracker, ref m_Version); } else { UpdateVersion.Reset(ref m_Version); } } else { m_Tracker = null; m_Version = -2; } } return(false); }
/// <summary> /// Locates the TrackedCamera for the given camera. /// </summary> static public TrackedCamera Get(Camera inCamera) { TrackedCamera tracker = inCamera.GetComponent <TrackedCamera>(); if (!tracker) { tracker = inCamera.gameObject.AddComponent <TrackedCamera>(); tracker.hideFlags = HideFlags.HideAndDontSave | HideFlags.HideInInspector; } return(tracker); }
public bool HasChanged() { if (Camera.IsReferenceDestroyed() || m_Tracker.IsReferenceDestroyed()) { Camera = null; m_Tracker = null; m_Version = -1; return(true); } if (!m_Tracker.IsReferenceNull()) { return(m_Tracker.HasChanged(ref m_Version)); } if (m_Version == -2) { m_Version = -1; return(true); } return(false); }
public void Clear() { Camera = null; m_Tracker = null; m_Version = -1; }