private bool TryCacheDebuggerDisplay(IObjectValueRole <TValue> valueRole, IMetadataTypeLite instanceType, IUserDataHolder userDataHolder) { // Special case. Replace with a second dictionary or whatever if we need to handle more types if (valueRole.ValueReference is NamedReferenceDecorator <TValue> reference && reference.IsNameFromValue && instanceType.FullName == "UnityEngine.GameObject") { userDataHolder.PutData(ourDebuggerDisplayStringKey, GameObjectDebuggerDisplayStringWithoutName); return(true); } // DebuggerDisplayAttribute is inherited. This is important for applying a debug string on Behaviour, and // having it used in custom MonoBehaviour classes var current = instanceType; while (current != null) { if (myDebuggerDisplayValues.TryGetValue(current.GetGenericTypeDefinition().FullName, out var displayString)) { userDataHolder.PutData(ourDebuggerDisplayStringKey, displayString); return(true); } current = current.BaseType; } return(false); }
public override bool IsAvailable(IUserDataHolder cache) { var isAvailable = base.IsAvailable(cache); if (isAvailable) { cache.PutData(InstanceKey, this); } return(isAvailable); }
public void PutData <T>(Key <T> key, T val) where T : class { _dataHolder.PutData(key, val); }
public override bool IsAvailable(IUserDataHolder cache) { var isAvailable = base.IsAvailable(cache); if (isAvailable) cache.PutData(InstanceKey, this); return isAvailable; }