public bool Replace(Transform inTransform, bool inbSync) { if (!ReferenceEquals(inTransform, Transform)) { Transform = inTransform; if (inTransform != null) { m_Tracker = TrackedTransform.Get(Transform); 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 TrackedTransform for the given transform. /// </summary> static public TrackedTransform Get(Transform inTransform) { TrackedTransform tracker = inTransform.GetComponent <TrackedTransform>(); if (!tracker) { tracker = inTransform.gameObject.AddComponent <TrackedTransform>(); } return(tracker); }
/// <summary> /// Locates the TrackedTransform for the given transform. /// </summary> static public TrackedTransform Get(Transform inTransform) { TrackedTransform tracker = inTransform.GetComponent <TrackedTransform>(); if (!tracker) { tracker = inTransform.gameObject.AddComponent <TrackedTransform>(); tracker.hideFlags = HideFlags.HideAndDontSave | HideFlags.HideInInspector; } return(tracker); }
public bool HasChanged() { if (Transform.IsReferenceDestroyed() || m_Tracker.IsReferenceDestroyed()) { Transform = 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() { Transform = null; m_Tracker = null; m_Version = -1; }