Skip to content

Commit 33f1784

Browse files
committed
Remove TweenEditorSetting from Resources folder
1 parent 068e794 commit 33f1784

18 files changed

+23
-8
lines changed

Core/Script/_Setting/Editor.meta renamed to Core/EditorResources/Images.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Core/Script/Editor/Setting.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Core/Script/_Setting/TweenEditorSetting.cs renamed to Core/Script/Editor/Setting/TweenEditorSetting.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
// E-mail : ls9512@vip.qq.com
77
//
88
/////////////////////////////////////////////////////////////////////////////
9+
#if UNITY_EDITOR
10+
using UnityEditor;
911
using UnityEngine;
1012

1113
namespace Aya.Tween
1214
{
13-
[CreateAssetMenu(menuName = "UTween/Tween Setting", fileName = "TweenEditorSetting")]
15+
[CreateAssetMenu(menuName = "UTween/Tween Editor Setting", fileName = "TweenEditorSetting")]
1416
public class TweenEditorSetting : ScriptableObject
1517
{
1618
#region Instance
@@ -21,7 +23,7 @@ public static TweenEditorSetting Ins
2123
{
2224
if (Instance == null)
2325
{
24-
Instance = Load(nameof(TweenEditorSetting));
26+
Instance = FindAsset<TweenEditorSetting>();
2527
}
2628

2729
return Instance;
@@ -30,12 +32,16 @@ public static TweenEditorSetting Ins
3032

3133
protected static TweenEditorSetting Instance;
3234

33-
internal static TweenEditorSetting Load(string fileName)
35+
internal static T FindAsset<T>() where T : Object
3436
{
35-
var ins = Resources.Load<TweenEditorSetting>(fileName);
36-
return ins;
37-
}
38-
37+
var guidList = AssetDatabase.FindAssets("t:" + typeof(T).FullName);
38+
if (guidList != null && guidList.Length > 0)
39+
{
40+
return AssetDatabase.LoadAssetAtPath<T>(AssetDatabase.GUIDToAssetPath(guidList[0]));
41+
}
42+
43+
return null;
44+
}
3945
#endregion
4046

4147
[Header("Icon")]
@@ -45,3 +51,4 @@ internal static TweenEditorSetting Load(string fileName)
4551
public Texture2D IconRefresh;
4652
}
4753
}
54+
#endif

0 commit comments

Comments
 (0)