private IAssetValue GetUnitySerializedPresentation()

in resharper/resharper-unity/src/Unity.Rider/Common/CSharp/Daemon/CodeInsights/UnityCodeInsightFieldUsageProvider.cs [247:271]


        private IAssetValue GetUnitySerializedPresentation(UnityPresentationType presentationType, ConstantValue? value)
        {
            var b = false;
            if (presentationType == UnityPresentationType.Bool && (value == null || value.IsBoolean(out b)))
                return b ? new AssetSimpleValue("1") : new AssetSimpleValue("0");

            if (presentationType == UnityPresentationType.ScriptableObject && (value == null || value.IsNull()))
                return new AssetReferenceValue(new LocalReference(0, 0));

            if (presentationType == UnityPresentationType.FileId && (value == null || value.IsNull()))
                return new AssetReferenceValue(new LocalReference(0, 0));

            if (presentationType is UnityPresentationType.OtherSimple or UnityPresentationType.Bool &&
                (value == null || value.IsNull()))
            {
                return new AssetSimpleValue("0");
            }

            if (value == null || value.IsNull())
                return new AssetSimpleValue(string.Empty);

#pragma warning disable CS0618
            return new AssetSimpleValue(value.Value?.ToString());
#pragma warning restore CS0618
        }