public void Refresh(bool invalidateCache) { if (string.IsNullOrEmpty(StyleKey)) { _activeStyle = null; return; } if (_cachedRoot == null || invalidateCache) { _cachedRoot = GetStyleRoot(); } if (_cachedRoot == null) { Debug.LogWarning("[StyleComponent] No active StyleRoot object found in parents.", this); _activeStyle = null; return; } var s = _cachedRoot.GetStyle(StyleKey); if (s == null) { Debug.LogWarning("[StyleComponent] Style not found ({0})".Fmt(StyleKey), this); _activeStyle = null; return; } _activeStyle = s; ApplyStyle(); }
private void SRStyleDirty() { // If inactive, invalidate the cached root and return. Next time it is enabled // a new root will be found if (!CachedGameObject.activeInHierarchy) { _cachedRoot = null; return; } Refresh(true); }