File size: 1,349 Bytes
18a519f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #if UNITY_EDITOR && UNITY_2021_1_OR_NEWER
#define CAN_USE_CUSTOM_HELP_URL
#endif
using System;
using System.Diagnostics;
using UnityEngine;
namespace UnityEngine.Timeline
{
#if CAN_USE_CUSTOM_HELP_URL
using UnityEditor.PackageManager;
[Conditional("UNITY_EDITOR")]
class TimelineHelpURLAttribute : HelpURLAttribute
{
const string k_BaseURL = "https://docs.unity3d.com/Packages/com.unity.timeline@";
const string k_MidURL = "/api/";
const string k_EndURL = ".html";
const string k_FallbackVersion = "latest";
static readonly string k_PackageVersion;
static TimelineHelpURLAttribute()
{
PackageInfo packageInfo = PackageInfo.FindForAssembly(typeof(TimelineAsset).Assembly);
k_PackageVersion = packageInfo == null ? k_FallbackVersion : packageInfo.version.Substring(0, 3);
}
public TimelineHelpURLAttribute(Type type)
: base(HelpURL(type)) {}
static string HelpURL(Type type)
{
return $"{k_BaseURL}{k_PackageVersion}{k_MidURL}{type.FullName}{k_EndURL}";
}
}
#else //HelpURL attribute is `sealed` in previous Unity versions
[Conditional("UNITY_EDITOR")]
class TimelineHelpURLAttribute : Attribute
{
public TimelineHelpURLAttribute(Type type) { }
}
#endif
}
|