NeoYG / Splashdown

Splashdown - A Unity open-source splash and icon generator

Home Page:https://github.com/Ale1/Splashdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

253230074-37fe6e8a-52dc-44cd-ae0a-321c54c53c1b openupm
github

Splashdown

A Unity open-source splash and icon tool that will generate custom icons with user-provided text. Allows for dynamic scripted content and to be incorporated into your build pipeline.

Its purpose is to aid in quick iteration of unity mobile games, and allow no-code team members such as Q.A testers, designers and general playtesters to quickly identify the build variant that is installed on their mobile device.
A quick glimpse at the generated icons and logos can give build release information without the need for opening the app or creating custom unity splashes.
The customizable text can be used to show things like date, author, build version, unity version, short release notes, beta tags, disclaimers, copyright notices, etc.

| splashdown1 | IMG_B492065383A8-1 |

Installation

Install via OpenUPM (recommended)

  1. Install openupm-cli via npm if you havent installed it before. => npm install -g openupm-cli)
  2. Install com.ale1.splashdown via command line. Make sure to run this command at the root of your Unity project =>openupm add com.ale1.splashdown

Install via Git URL

Add the following line to the dependencies section of your project's manifest.json file

"com.ale1.splashdown": "git+https://github.com/Ale1.Splashdown.git#1.2.3" The 1.2.3 represents the version tag to be fetched. Although it is discouraged, you can replace with master to always fetch the latest.

Getting Started

(1) Hello World

Right-click on any location within the Assets Folder. Navigate to Create > New Splashdown in the context menu.
A Splashdown file will appear.

Fill in the Splashdown Importer window and hit Apply button.

Screenshot 2023-08-09 at 18 30 40

Congrats! you generated your first custom Logo/Icon

(2) Using it as Splash Logo

This generated sprite can be used as a logo in your Player Settings. By setting hitting Activate Splash button, the playerSettings will start using this sprite as its splash image:

Screenshot 2023-07-30 at 11 42 27
you can remove it by selecting "Deactive" in the splashdown editor

(3) Using it as App Icon

The same generated sprite can be used as an app icon when you build. Similarly to Splash logos, you just need to set its icon state to active by pressing "Activate Icon:

⚠️ Unlike splash logos, activating an icon does NOT apply it to Player Settings right away. It will wait for the start of a app build process. This is by design, as the icon is meant to be a temporary placeholder during development and applying icons during build process allows for a safer restore of your previous icons after build process is complete.

(4) Dynamic Options

The Dynamic Options feature will allow you to quickly update the splashdown file without manually typing in info. Its particularly useful for allowing splashdown to keep track of dates or build versions. Create a script like below and place it anywhere in your project (though preferably in an Editor folder). The splashdown importer will automatically invoke methods with the [Splashdown.OptionsProvider] attribute whenever its refreshed. Dynamically created Options will override any manual inputs in the splashdown importer.

public static class Example  
{
        [Splashdown.OptionsProvider] //Method with this atrribute must return a Splashdown.Options
        public static Splashdown.Options ProvideSplashdownOptions() => new()
        { 
                line1 = Application.unityVersion, // e.g 2021.3.4f
                line2 = DateTime.Now.ToShortDateString(), 
                line3 = Application.version, //e.g 2.1.0
                textColor = Color.red,

                // no need to set all of available options. Those without values will use the manual values instead.
                // backgroundColor = Color.blue
        };
}

Dynamic options can accept an optional filter parameter that filters by filename (without extension), so it will only apply to specific Spashdowns. E.g:

[Splashdown.OptionsProvider("MyBlueLogo")]
//will only affect options of splashdown with name: 'MyBlueLogo.splashdown'
public static Splashdown.Options ProvideSplashdownOptions() => new()
{ 
         ... 
}

The optional filter can use "*" as a wildcard regex character. For example:

[Splashdown.OptionsProvider("Dev*Logo")]
//will match with any splashdown with names such as: 'DevRedLogo.splashdown', 'DevBlueLogo.splashdown', etc
public static Splashdown.Options ProvideSplashdownOptions() => new()
{ 
         ... 
}

Values in the inspector that have been overriden by dynamic options will have a yellow label, e.g, in example below, line1, line2 and text color values dont match the splashdown generated because these have been provided by a dynamic options script. The Class and Method name creating these overrides can be seen inside the information box.

Screenshot 2023-08-27 at 14 36 59

(5) Add splashdown to your builds

Any splashdown file that is set to ACTIVE will regenerate when unity is building. This means the latest values from dynamic options will be used, as well as adding the splash and/or logo to your Player Settings.
If you dont desire this behaviour, simply leave the splashdown files in INACTIVE state.

(6) Add Splashdown to your build pipeline through CLI

below will activate the splashdown file with the provided filename, and apply the options.

_yourUnityPath_ -batchmode -quit -projectPath _yourProjectPath_ -executeMethod Splashdown.Editor.CLI.SetSplashOptions -name MySplashdown -l1 hello -l2 banana -l3 world -size 44
//Mandatory param:
-name MySplashdown // the name of the splashdown file to apply. note that the default name is "MySplashdown" but you should replace with target filename if you've changed it in your project.

//Optional Flags:
-enable_splash    // use as splash logo
-enable_icon      // use as app icon
-disable_splash   // remove logo from splash
-disable_icon     // remove icons and restore previous icons
-enableDynamic    //sets dynamic options to false
-disableDynamic   //sets dynamic options to true
-size //sets the target font size (will be clamped if outside valid range)

Example for MacOS:

 /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath ~/Desktop/MyCoolGame -executeMethod Splashdown.Editor.CLI.SetSplashOptions -name MySplashdown -activeSplash -l1 hello -l2 cruel -l3 world - size 44

Example for Windows:

"C:\Program Files\Unity\Editor\Unity.exe" -quit -batchmode -projectPath "C:\Users\UserName\Documents\MyProject" -executeMethod Splashdown.Editor.CLI.SetSplashOptions -name "MySplashdown" -disableDynamic -l1 "Banana" -l2 "Yellow" -size 52
MyEditorScript.PerformBuild

Advanced Customization

Conflicting Options Resolution

Since you can provide options through multiple avenues, keep in mind the order of priority below (most to least).

(1) Dynamic Options

(2) CLI Options

(3) Options set manually in inspector

(4) Default Options

Options with higher Priority will override ones with lower priority.

Managing multiple Splashdown files

Important

Having Multiple Splashdown assets in your project is supported, but they each must have unique filenames.

How the system handles multiple Splashdown files varies between splash logos and app icons:

Multiple Splash logos

You can have any number of splashdown files set to "Active Splash". All the Splash logos will be present sequentially in your splash screen. When you activate/deactivate a splash in the Splashdown inspector, it is automatically added or removed from your Player Settings in editor-time.

Multiple App Icons

For App icons, the Player settings dont allow for multiple icons for each category. Hence, when you activate an Icon, the system will check for other existing activated icons and disable those first.
This silent behaviour will be modified in the future to introduce a warning when trying to activate an icon when another icon is already active.

Using a texture as background

Works best when using a square non-transparent texture of dimensions 360 x 360.

Screenshot 2023-08-09 at 15 26 40

Switching Fonts

You can switch the font used by using the Font Selector field in the splashdown inspector. Any font asset in your project can be used. The label above the font selector should update to show the path to the font currently being used. Keep in mind the font Selector field is always shown empty as its used for drag-and-dropping font asset files.
After switching fonts, you will likey need to adjust the font size to fit your needs. A feature to auto-resize the text will be introduced in a future release.

Customizing the Border

Customizing the border is possible, but the feature is not high-priority in the roadmap. If there is a use-case where modifying the borders provides an additional benefit other than cosmetic, pls open an issue describing your use-case and I will gladly look into it.

Supported Unity Versions

Version Supported Notes
< 2021.X ✖️ not supported will support if error also applies to higher unity versions
2021.X ✅ supported pls submit issue if encountering problems
2022.X ✅ supported (same as above)
2023.X ❔ supported (untested) (same as above)

FAQ

  • My Dynamic options are overriding the options passed through CLI!?

You can disable the dynamic options with the optional flag provided. You can also use Dynamic Options optional filter parameter or simply have the DynamicOptions only override a certain line and leave the rest for the CLI options to fill. See Conflicting Options Resolution section.

  • I want to use the generated logo for something else, how can I extract the texture from the splashdown file?

A texture is generated and saved as a sub-asset of the splashdown file. you can copy it to your clipboard from the project hierarchy, and paste it elsewhere in your project to get a clone of the texture. There are several ways to programatically extract the texture -let me know your use-case if you need assistance with this.

  • I want use a generated splashdown logo for a custom splash screen. How do I reference the generated sprite for use in my scene?

You can drag-and-drop any splashdown file unto the sprite field of an Image or Sprite Renderer component in your scene. When the original splashdown sprite regenerates, so will the sprite in your scene. If you want to keep the sprite static, see above about manually making a copy and using that as your Image/Sprite renderer sprite.

  • Can I use non-latin alphabets (e.g Kanji, Akson Thai, Hangul) ?

Yes! but you will likely need to provide your own font as the built-in fonts are very limited in the amount of characters available. The package comes with NanumGothic as a sample font that is compatible with korean and RobotoMono (the default font) is compatible with cyrillic.
There are plenty of free fonts available that will work well with non-latin languages. I have not included them in this package to avoid bloating the size of the package with unecessary fonts. See instructions for adding & switching fonts and feel free to open an issue if you are unable to get your preferred language working properly.

License

MIT License. Refer to the LICENSE.md file.

About

Splashdown - A Unity open-source splash and icon generator

https://github.com/Ale1/Splashdown

License:MIT License


Languages

Language:C# 100.0%