处理unity版本兼容

This commit is contained in:
monitor1394
2021-04-12 19:31:26 +08:00
parent 5205c9a53f
commit 620d7b4698
2 changed files with 14 additions and 19 deletions

View File

@@ -9,10 +9,6 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEditor.Compilation;
using System.IO;
using System;
using System.Collections.Generic;
namespace XCharts
{

View File

@@ -17,7 +17,6 @@ using UnityEngine.SceneManagement;
using System.IO;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Compilation;
#endif
namespace XCharts
@@ -120,20 +119,20 @@ namespace XCharts
networkError = "";
var url = "https://raw.githubusercontent.com/monitor1394/unity-ugui-XCharts/master/Assets/XCharts/package.json";
var web = UnityWebRequest.Get(url);
#if UNITY_5
yield return web.Send();
#else
#if UNITY_2017_3_OR_NEWER
yield return web.SendWebRequest();
#else
yield return web.Send();
#endif
CheckVersionWebRequest(web);
if (isNetworkError)
{
url = "https://gitee.com/monitor1394/unity-ugui-XCharts/raw/master/Assets/XCharts/package.json";
web = UnityWebRequest.Get(url);
#if UNITY_5
yield return web.Send();
#if UNITY_2017_3_OR_NEWER
yield return web.SendWebRequest();
#else
yield return web.SendWebRequest();
yield return web.Send();
#endif
CheckVersionWebRequest(web);
}
@@ -141,19 +140,19 @@ namespace XCharts
{
url = "https://raw.githubusercontent.com/monitor1394/unity-ugui-XCharts/master/Assets/XCharts/CHANGELOG.md";
web = UnityWebRequest.Get(url);
#if UNITY_5
yield return web.Send();
#if UNITY_2017_3_OR_NEWER
yield return web.SendWebRequest();
#else
yield return web.SendWebRequest();
yield return web.Send();
#endif
if (!CheckLogWebRequest(web))
{
url = "https://gitee.com/monitor1394/unity-ugui-XCharts/raw/master/Assets/XCharts/CHANGELOG.md";
web = UnityWebRequest.Get(url);
#if UNITY_5
yield return web.Send();
#if UNITY_2017_3_OR_NEWER
yield return web.SendWebRequest();
#else
yield return web.SendWebRequest();
yield return web.Send();
#endif
CheckLogWebRequest(web);
}
@@ -391,8 +390,8 @@ namespace XCharts
{
if (assembly.name.Equals("Unity.TextMeshPro")) return true;
}
#else
foreach (var assembly in CompilationPipeline.GetAssemblies())
#elif UNITY_2017_3_OR_NEWER
foreach (var assembly in UnityEditor.Compilation.CompilationPipeline.GetAssemblies())
{
if (assembly.name.Equals("Unity.TextMeshPro")) return true;
}