Skip to content

Change script icon color in Unity.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

gamesbyBAE/script-icon-customiser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Script Icon Customiser C# Unity MIT GitHub repo size

Customise script assets icon and/or their tint color in the Unity Editor.

Table of Contents

Overview

Script Icon Customiser provides a small Unity Editor utility window that allows you to:-

  1. Change the icon displayed for script (C#) asset files in the Unity Project window.
  2. Revert back to default Unity script icon.

You can customise & apply a new icon to one or multiple selected scripts by either:-

  1. choosing a custom icon texture from you project assets and/or apply a tint color to further customise it,
  2. or simply changing the color (tint) of the default Unity script icon.

Key Features

  • Clean UI built with UIElements (VisualElement + USS).
  • The icon is reflected in the Unity Inspector and everywhere in Unity Editor.
  • Move your custom Texture2D icon asset within the project safely without script icons reverting to default.
  • Quick restore to Unity default icon.
  • Exists only in the Editor, nothing's packaged into the build.

Installation

Note

Recommended Unity Editor version 6000.3+, albeit supports 2021.3+.
Some UI alignments might be iffy in Editor versions below 6000.3 but does the job it's meant to.

Option 1: Install via Unity Package Manager (Git URL) - Recommended

This makes it easier to update the package from the Package Manager directly.

  1. Open your project in Unity.

  2. Go to Window ➜ Package Manager or Window ➜ Package Management ➜ Package Manager

  3. Click the + button in the top-left corner.

  4. Select Add package from git URL… or Install package from git URL…

  5. Paste this repository URL:

https://github.com/gamesbyBAE/script-icon-customiser.git
  1. Click Add or Install

  2. Unity will download and install the package automatically.


Option 2: Install via manifest.json

  1. Open your Unity project.

  2. Navigate to:

Path/Of/Your/UnityProject/Packages/manifest.json
  1. Add the package under dependencies:
{
  "dependencies": {
    "com.basement-experiments.script-icon-customiser": "https://github.com/gamesbyBAE/script-icon-customiser.git"
  }
}
  1. Save the file and return to Unity.
    Unity will automatically resolve and install the package.

Option 3: Install via Local Package (Clone Repository)

  1. Clone the repository to your local machine:
git clone https://github.com/gamesbyBAE/script-icon-customiser.git
  1. Open your project in Unity

  2. Go to Window ➜ Package Manager or Window ➜ Package Management ➜ Package Manager

  3. Click the + button in the top-left corner.

  4. Select Add package from disk… or Install package from disk...

  5. Browse and navigate to the cloned repository.

  6. Select and open the package.json file.

  7. The package will now be added as a local package.

Note: Local packages are linked to the folder on disk. Any changes made to the package files will immediately reflect in Unity. Hence, good for modding the package and testing.

Usage

Steps to Apply Custom Icon:

  1. Select one or more script assets in the Project window.

  2. Open the Editor Window:

    • Menu: Assets ➜ Script Icon ➜ Change Icon
    • Shortcut: Cmd/Ctrl + Alt + Shift + C (%&#c)
    • Right Click Menu: Right Click ➜ Script Icon ➜ Change Icon
  3. Use the Image Picker to choose a custom texture (or choose None to use Unity’s default MonoScript icon).

  4. Use the Color Picker to choose a tint color (optional).

  5. Preview shows the, you-guessed-it, the preview (result). Adjust color or texture as needed.

  6. You can drag & drop more scripts to be modified in the Target Scripts area.

  7. Click Apply to set the icon for selected MonoScript assets.

Steps to Restore Default Icon:

  1. Select one or more script assets in the Project window.

  2. There are two ways to restore:-

    1. Quick Restore:

      • Menu: Assets ➜ Script Icon ➜ Restore Icon
      • Shortcut: Cmd/Ctrl + Alt + Shift + R (%&#r)
      • Right Click Menu: Right Click ➜ Script Icon ➜ Restore Icon
    2. From Editor Window:

      1. Follow any of the below option to open the window:
        • Menu: Assets ➜ Script Icon ➜ Change Icon
        • Shortcut: Cmd/Ctrl + Alt + Shift + C (%&#c)
        • Right Click Menu: Right Click ➜ Script Icon ➜ Change Icon
      2. You can drag & drop more scripts to be modified in the Target Scripts area.
      3. Click Restore to set the default Unity MonoScript asset icon.

Code References

Notes

  • The utility modifies the icon set via MonoImporter.SetIcon followed by SaveAndReimport(), which may trigger a reimport for the asset(s). This is normal.

  • Icon textures that are tinted and not in their stock form are saved to the directory, Assets/BasementExperiments/CustomScriptIcons.

    • Necessary to save in the project because Unity uses the GUID to map the icon to the project asset.
    • For the case, package is installed from local disk, it's possible to directly save the icons in the package directory itself without bloating your actual Unity project directory.

Contributions

Contributions welcome via PRs - fixes, performance improvements, or feature additions.

  1. Open a new Unity project.
  2. Create a new directory in the project's Assets directory, Assets ➜ <your-directory-name>
  3. Clone the repository into this newly created directory.
  4. Explore the code under Editor/Scripts for logic and Editor/Stylesheets to modify styles.
    All the scripts must live inside the Editor directory.
  5. Run the window from the menu, Assets ➜ Script Icon ➜ Change Icon.

License

MIT, see LICENSE in this folder.

Contact

Mayank 'DerperDoing' Bagchi
www.mayankbagchi.dev

Medium YouTube Channel Views

About

Change script icon color in Unity.

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages