Skip to content

Commit 57e09ff

Browse files
committed
fix(editor): 将欢迎窗口的logo加载方式从Resources改为AssetDatabase
Resources文件夹已被移除,logo图片已移至Editor Default Resources。 更新WelcomeWindow.cs中的LoadLogoTexture方法,使用AssetDatabase.FindAssets 和LoadAssetAtPath来动态加载logo,确保在Unity编辑器中正确显示。
1 parent 69581c1 commit 57e09ff

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

Editor Default Resources.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.
File renamed without changes.
File renamed without changes.

Editor/Welcome/WelcomeWindow.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class WelcomeWindow : EditorWindow
3838
{
3939
private static readonly string FirstRunKey = "GameFrameX_WelcomeWindow_Shown";
4040
private static readonly string ShowOnStartupKey = "GameFrameX_ShowOnStartup";
41+
private const string LogoAssetPath = "gameframex_logo.png";
4142

4243
private bool showOnStartup = true;
4344
private Vector2 scrollPosition;
@@ -90,8 +91,15 @@ private void OnEnable()
9091

9192
private void LoadLogoTexture()
9293
{
93-
// 方式1: 从Resources文件夹加载(如果Logo放在Resources文件夹中)
94-
_logoTexture = Resources.Load<Texture2D>("gameframex_logo");
94+
var assets = AssetDatabase.FindAssets("t:Texture gameframex_logo");
95+
if (assets.Length <= 0)
96+
{
97+
_logoTexture = null;
98+
return;
99+
}
100+
101+
var path = AssetDatabase.GUIDToAssetPath(assets[0]);
102+
_logoTexture = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
95103
}
96104

97105
private void OnGUI()

Resources.meta

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)