-
Notifications
You must be signed in to change notification settings - Fork 341
Expand file tree
/
Copy pathExample_73_SetAppIcon.cs
More file actions
36 lines (31 loc) · 1.23 KB
/
Example_73_SetAppIcon.cs
File metadata and controls
36 lines (31 loc) · 1.23 KB
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
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace UnityToolchinsTrick
{
public class Example_73_SetAppIcon
{
private const string icon_path = "Assets/Editor/Examples/Example_73_SetAppIcon/icon.png";
[MenuItem("Tools/Example_73_SetAppIcon/SetDefaultIcon", priority = 73)]
private static void SetDefaultIcon()
{
Texture2D texture = AssetDatabase.LoadAssetAtPath<Texture2D>(icon_path);
UnityInternalAPIEngineBridger.SetDefaultIcon(texture);
}
[MenuItem("Tools/Example_73_SetAppIcon/SetAppIcon", priority = 73)]
private static void SetAppIcon()
{
Texture2D texture = AssetDatabase.LoadAssetAtPath<Texture2D>(icon_path);
int[] iconSize = PlayerSettings.GetIconSizesForTargetGroup(BuildTargetGroup.iOS);
Texture2D[] textureArray = new Texture2D[iconSize.Length];
for (int i = 0; i < textureArray.Length; i++)
{
textureArray[i] = texture;
}
textureArray[0] = texture;
PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.iOS, textureArray);
AssetDatabase.SaveAssets();
}
}
}