This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
src/UnityExtension/Assets/Editor/GitHub.Unity Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,25 @@ public static Texture2D GetIcon(string filename, string filename2x = "")
16
16
filename = filename2x ;
17
17
}
18
18
19
+ Texture2D texture2D = null ;
20
+
19
21
var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "GitHub.Unity.IconsAndLogos." + filename ) ;
20
22
if ( stream != null )
21
- return stream . ToTexture2D ( ) ;
23
+ {
24
+ texture2D = stream . ToTexture2D ( ) ;
25
+ }
26
+ else
27
+ {
28
+ var iconPath = EntryPoint . Environment . ExtensionInstallPath . Combine ( "IconsAndLogos" , filename ) . ToString ( SlashMode . Forward ) ;
29
+ texture2D = AssetDatabase . LoadAssetAtPath < Texture2D > ( iconPath ) ;
30
+ }
31
+
32
+ if ( texture2D != null )
33
+ {
34
+ texture2D . hideFlags = HideFlags . HideAndDontSave ;
35
+ }
22
36
23
- var iconPath = EntryPoint . Environment . ExtensionInstallPath . Combine ( "IconsAndLogos" , filename ) . ToString ( SlashMode . Forward ) ;
24
- return AssetDatabase . LoadAssetAtPath < Texture2D > ( iconPath ) ;
37
+ return texture2D ;
25
38
}
26
39
27
40
public static Texture2D GetTextureFromColor ( Color color )
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ class Window : BaseWindow
40
40
[ SerializeField ] private CacheUpdateEvent lastCurrentBranchAndRemoteChangedEvent ;
41
41
[ NonSerialized ] private bool currentBranchAndRemoteHasUpdate ;
42
42
43
+ [ NonSerialized ] private Texture2D smallLogo ;
44
+
43
45
[ MenuItem ( LaunchMenu ) ]
44
46
public static void Window_GitHub ( )
45
47
{
@@ -102,7 +104,11 @@ public override void OnEnable()
102
104
Selection . activeObject = this ;
103
105
#endif
104
106
// Set window title
105
- titleContent = new GUIContent ( Title , Styles . SmallLogo ) ;
107
+ if ( smallLogo == null )
108
+ {
109
+ smallLogo = Styles . SmallLogo ;
110
+ titleContent = new GUIContent ( Title , smallLogo ) ;
111
+ }
106
112
107
113
if ( Repository != null )
108
114
Repository . CheckCurrentBranchAndRemoteChangedEvent ( lastCurrentBranchAndRemoteChangedEvent ) ;
You can’t perform that action at this time.
0 commit comments