123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using UnityEditor;
- using UnityEngine;
- public class SplashUtils
- {
- [MenuItem("SDK/SetSplashImage")]
- public static void SetSplashImage()
- {
- PlayerSettings.SplashScreen.show = true;
- PlayerSettings.SplashScreen.backgroundColor = Color.black;
- PlayerSettings.SplashScreenLogo[] logos = PlayerSettings.SplashScreen.logos;
- var logo = new PlayerSettings.SplashScreenLogo();
- string splashAssetPath = AssetDatabase.GUIDToAssetPath(AssetDatabase.FindAssets("SplashImg")[0]);
- logo.duration = 2f;
- logo.logo = AssetDatabase.LoadAssetAtPath<Sprite>(splashAssetPath);
- if (logos == null)
- {
- logos = new PlayerSettings.SplashScreenLogo[] { logo };
- }
- else
- {
- List<PlayerSettings.SplashScreenLogo> logoList = new List<PlayerSettings.SplashScreenLogo>(logos);
- logoList.Add(logo);
- logos = logoList.ToArray();
- }
- PlayerSettings.SplashScreen.logos = logos;
- }
- }
|