public AttributeCache(IAttributeProvider element) { Ensure.That(nameof(element)).IsNotNull(element); try { inheritedAttributes = element.GetCustomAttributes(true); } catch (UnityException) { // Likely a main thread API call } catch (Exception ex) { Debug.LogWarning($"Failed to fetch inherited attributes on {element}.\n{ex}"); } try { inheritedAttributes = element.GetCustomAttributes(false); } catch (UnityException) { // Likely a main thread API call } catch (Exception ex) { Debug.LogWarning($"Failed to fetch defined attributes on {element}.\n{ex}"); } FallbackAttributes(); }
public AttributeCache(IAttributeProvider element) { Ensure.That(nameof(element)).IsNotNull(element); try { Cache(element.GetCustomAttributes(true), inheritedAttributes); } catch (Exception ex) { Debug.LogWarning($"Failed to fetch inherited attributes on {element}.\n{ex}"); } try { Cache(element.GetCustomAttributes(false), definedAttributes); } catch (Exception ex) { Debug.LogWarning($"Failed to fetch defined attributes on {element}.\n{ex}"); } }