Tri-Inspector/Editor/TriValue.cs
2022-05-11 11:23:11 +03:00

37 lines
791 B
C#

using System;
using JetBrains.Annotations;
namespace TriInspector
{
public struct TriValue<T>
{
internal TriValue(TriProperty property)
{
Property = property;
}
public TriProperty Property { get; }
[Obsolete("Use SmartValue instead", true)]
public T Value
{
get => (T) Property.Value;
set => Property.SetValue(value);
}
[PublicAPI]
public T SmartValue
{
get => (T) Property.Value;
set
{
if (TriProperty.AreValuesEqual(Property.FieldType, Property.Value, value))
{
return;
}
Property.SetValue(value);
}
}
}
}