diff --git a/src/CacheObject/CacheObjectBase.cs b/src/CacheObject/CacheObjectBase.cs index 764f081..c24c43c 100644 --- a/src/CacheObject/CacheObjectBase.cs +++ b/src/CacheObject/CacheObjectBase.cs @@ -96,23 +96,6 @@ namespace UnityExplorer.CacheObject // Updating and applying values - public void SetUserValue(object value) - { - value = value.TryCast(FallbackType); - - TrySetUserValue(value); - - if (CellView != null) - SetDataToCell(CellView); - - // If the owner's ParentCacheObject is set, we are setting the value of an inspected struct. - // Set the inspector target as the value back to that parent. - if (Owner.ParentCacheObject != null) - Owner.ParentCacheObject.SetUserValue(Owner.Target); - } - - public abstract void TrySetUserValue(object value); - // The only method which sets the CacheObjectBase.Value public virtual void SetValueFromSource(object value) { @@ -132,6 +115,23 @@ namespace UnityExplorer.CacheObject } } + public void SetUserValue(object value) + { + value = value.TryCast(FallbackType); + + TrySetUserValue(value); + + if (CellView != null) + SetDataToCell(CellView); + + // If the owner's ParentCacheObject is set, we are setting the value of an inspected struct. + // Set the inspector target as the value back to that parent. + if (Owner.ParentCacheObject != null) + Owner.ParentCacheObject.SetUserValue(Owner.Target); + } + + public abstract void TrySetUserValue(object value); + protected virtual void ProcessOnEvaluate() { var prevState = State; @@ -171,7 +171,7 @@ namespace UnityExplorer.CacheObject public ValueState GetStateForType(Type type) { - if (LastValueType == type) + if (LastValueType == type && (State != ValueState.Exception || LastException != null)) return State; LastValueType = type; diff --git a/src/Tests/TestClass.cs b/src/Tests/TestClass.cs index 776b2e5..0589320 100644 --- a/src/Tests/TestClass.cs +++ b/src/Tests/TestClass.cs @@ -28,7 +28,23 @@ namespace UnityExplorer.Tests public static object LiterallyAnything = null; - public static string Exception => throw new Exception("This is a test."); + public static string Exception + { + get + { + if (!shouldThrow) + { + shouldThrow = true; + throw new Exception("This is a test."); + } + else + { + shouldThrow = false; + return "No exception"; + } + } + } + static bool shouldThrow; // Test enumerables public static int[,,] MultiDimensionalArray = new int[45, 45, 45];