Search Unity

Feature Request Suggestion: Custom Unity Splash Screens

Discussion in 'Editor & General Support' started by Deblasio, Sep 1, 2022.

?

Which Idea

  1. Many splash screen choices

  2. Custom splash screens to be validated by moderators

  3. New subscription tier to allow custom splashscreens or removal of unity splashscreen

Multiple votes are allowed.
Results are only viewable after voting.
  1. Deblasio

    Deblasio

    Joined:
    Sep 24, 2019
    Posts:
    1
    Allow us to choose between multiple styles of watermarks, or maybe a system where a user can upload a custom splashscreen to be approved by moderators or anyone who can if they want a spash screen matching their game's theme. The moderators would check if the unity logo is visible and is valid.

    Or alternatively, a cheaper plan to just remove splash screens.
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    You can slightly customize it already.
    More customization simply is a Unity Pro thing (very stupid, but that's something up to Unity)
     
  3. zereda-games

    zereda-games

    Joined:
    Dec 8, 2016
    Posts:
    14
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.SceneManagement;
    4. using System.Collections;
    5. using TMPro;
    6.  
    7. namespace ZeredaGames
    8. {
    9.     [RequireComponent(typeof(Canvas))]
    10.     public class CustomSplashScreen : MonoBehaviour
    11.     {
    12.         [SerializeField] int splashScreenCount = 1;
    13.         [SerializeField] Text companySignatureText;
    14.         [SerializeField] Image fadeImage;
    15.         [SerializeField] float fadeDuration = 2.135f;
    16.  
    17.         [SerializeField] bool addSound;
    18.         [SerializeField] AudioClip splashAudioClip;
    19.         AudioSource source;
    20.  
    21.         [SerializeField] bool addAnimation;
    22.         Animator animator;
    23.         [SerializeField] RuntimeAnimatorController animatorController;
    24.         [SerializeField] string runAnimationStateName = "Animate";
    25.         private void Awake()
    26.         {
    27.             if (animator == null && addAnimation)
    28.             {
    29.                 if (GetComponent<Animator>() == null)
    30.                     animator = gameObject.AddComponent<Animator>();
    31.                 else
    32.                     animator = GetComponent<Animator>();
    33.                 if (animatorController != null)
    34.                     animator.runtimeAnimatorController = animatorController;
    35.             }
    36.             if (source == null && addSound)
    37.             {
    38.                 if(GetComponent<AudioSource>() == null)
    39.                     source = gameObject.AddComponent<AudioSource>();
    40.                 else
    41.                     source = GetComponent<AudioSource>();
    42.                 if (source.clip == null)
    43.                     source.clip = splashAudioClip;
    44.             }
    45.             if (fadeImage != null) StartFade();
    46.             else
    47.             {
    48.                 fadeImage =  GameObject.Find("FadeImage").GetComponent<Image>();
    49.                 StartFade();
    50.             }
    51.         }
    52.         void StartFade()
    53.         {
    54.             if (fadeImage != null)
    55.                 FadeOutText(companySignatureText, 0);
    56.             FadeInImage(fadeImage, 0);
    57.             FadeOutImage(fadeImage, fadeDuration);
    58.             StartCoroutine(RunSplash(fadeDuration));
    59.         }
    60.         IEnumerator RunSplash(float startWaitTime)
    61.         {
    62.             if (addAnimation)
    63.                 animator.Play(runAnimationStateName);
    64.  
    65.             if (fadeImage != null)
    66.                 FadeInText(companySignatureText, startWaitTime);
    67.  
    68.             yield return new WaitForSeconds(startWaitTime);
    69.  
    70.             if (addSound)
    71.             {
    72.                 source.Play();
    73.                 yield return new WaitWhile(() => source.isPlaying == false);
    74.             }
    75.  
    76.             yield return new WaitForSeconds(startWaitTime);
    77.  
    78.             FadeInImage(fadeImage, startWaitTime);
    79.  
    80.             yield return new WaitForSeconds(startWaitTime);
    81.  
    82.             SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    83.         }
    84.         #region Fading Display Message Text
    85.         /// <summary>
    86.         /// Displays a message over time and then disapears
    87.         /// </summary>
    88.         /// <param name="text">The Text field to modify</param>
    89.         /// <param name="message"></param>
    90.         /// <param name="color"></param>
    91.         /// <param name="fadeTimer"></param>
    92.         public static void DisplayFadeMessage(Text text, string message, Color color, float fadeTimer)
    93.         {
    94.             FadeInText(text, 0);
    95.             text.color = color;
    96.             text.text = message;
    97.             FadeOutText(text, fadeTimer);
    98.         }
    99.         /// <summary>
    100.         /// Displays a message over time and then disapears
    101.         /// </summary>
    102.         /// <param name="text">The Text field to modify</param>
    103.         /// <param name="message"></param>
    104.         /// <param name="color"></param>
    105.         /// <param name="fadeTimer"></param>
    106.         public static void DisplayFadeMessage(TMP_Text text, string message, Color color, float fadeTimer)
    107.         {
    108.             FadeInText(text, 0);
    109.             text.color = color;
    110.             text.text = message;
    111.             FadeOutText(text, fadeTimer);
    112.         }
    113.         /// <summary>
    114.         /// Fades out an Text over time. [Make full invisable]
    115.         /// </summary>
    116.         /// <param name="text">The text used to fade.</param>
    117.         /// <param name="fadeLength">How long it fades to alpha 0.</param>
    118.         static void FadeOutText(Text text, float fadeLength)
    119.         {
    120.             text.CrossFadeAlpha(0.0f, fadeLength, false);
    121.             if (text.color.a == 0)
    122.                 text.text = "";
    123.         }
    124.         static void FadeOutText(TMP_Text text, float fadeLength)
    125.         {
    126.             text.CrossFadeAlpha(0.0f, fadeLength, false);
    127.             if (text.color.a == 0)
    128.                 text.text = "";
    129.         }
    130.         /// <summary>
    131.         /// Fades in an Text over time. [Make full visable]
    132.         /// </summary>
    133.         /// <param name="text">The text used to fade.</param>
    134.         /// <param name="fadeLength">How long it fades to alpha 1.</param>
    135.         static void FadeInText(Text text, float fadeLength)
    136.         {
    137.             text.CrossFadeAlpha(1.0f, fadeLength, false);
    138.         }
    139.         static void FadeInText(TMP_Text text, float fadeLength)
    140.         {
    141.             text.CrossFadeAlpha(1.0f, fadeLength, false);
    142.         }
    143.         #endregion Fading Display Message Text
    144.         #region Fading Image
    145.         /// <summary>
    146.         /// Fades out an image over time. [Make full invisable]
    147.         /// </summary>
    148.         /// <param name="FadeImage">The Image used to fade.</param>
    149.         /// <param name="fadeLength">How long it fades to alpha 0.</param>
    150.         public static void FadeOutImage(Image image, float fadeLength)
    151.         {
    152.             image.gameObject.SetActive(true);
    153.             image.CrossFadeAlpha(0.0f, fadeLength, false);
    154.         }
    155.         /// <summary>
    156.         /// Fades in an image over time. [Make full visable]
    157.         /// </summary>
    158.         /// <param name="FadeImage">The Image used to fade.</param>
    159.         /// <param name="fadeLength">How long it fades to alpha 1.</param>
    160.         public static void FadeInImage(Image image, float fadeLength)
    161.         {
    162.             image.gameObject.SetActive(true);
    163.             image.CrossFadeAlpha(1.0f, fadeLength, false);
    164.         }
    165.         #endregion Fading Image
    166.     }
    167. }