Git Product home page Git Product logo

unityfoldercleaner's Introduction

Unity Folder Cleaner

CodeFactor

Small utility to delete empty folder from the Unity project.

Based from a script in Unity3D College

Usage

Open the utility at Window > Tools > Clean Empty Folders.

It will scan all the folders in your project and delete empty folders.

Installation

Using Open UPM

You can install this package using OpenUPM's command line tool:

openupm add dev.bullrich.folder-cleaner

Adding the package to the Unity project manifest

  • Navigate to the Packages directory of your project.

  • Adjust the project manifest file manifest.json in a text editor.

    • Ensure https://package.openupm.com is part of scopedRegistries.
      • Ensure dev.bullrich is part of scopes.
    • Add dev.bullrich.folder-cleaner to dependencies, stating the latest version.

    A minimal example ends up looking like this. Please note that the version X.Y.Z stated here is to be replaced with the latest released version which is currently openupm.

    {
      "scopedRegistries": [
        {
          "name": "package.openupm.com",
          "url": "https://package.openupm.com",
          "scopes": [
            "dev.bullrich"
          ]
        }
      ],
      "dependencies": {
        "dev.bullrich.folder-cleaner": "X.Y.Z"
      }
    }
  • Switch back to the Unity software and wait for it to finish importing the added package.

Enabling verbose logs

If you want the log to list every directory that will be scanned you can add the Scripting Define Symbol FOLDER_CLEANER_VERBOSE to your project and it be more verbose when running.

Add editor test

There is a unit test to ensure that there are no empty directories in the project.

If you want to add this test to your project you can add it following this steps:

  • Navigate to the Packages directory of your project.

  • Adjust the project manifest file manifest.json in a text editor.

    • Ensure dev.bullrich.folder-cleaner is part of testables.

    A minimal example ends up looking like this.

    {
      "scopedRegistries": [
        ...
      ],
      "testables": [
        "dev.bullrich.folder-cleaner"
      ],
      "dependencies": {
        ...
      }
    }
  • As noted in the official Unity documentation:

    NOTE: You may need to re-import the package, because the test framework doesn't always immediately pick up changes to the testables attribute.

    • Within the Unity software's Project window expand the Packages node.
    • Right-click on the Folder Cleaner child node and choose Reimport.
    • Wait for the Unity software to finish re-importing the package.
  • In the Unity software select Main Menu -> Window -> Test Runner.

  • Within the Test Runner window click on the EditMode tab and the click Run All button.

  • If all the tests pass then the installation was successful.

unityfoldercleaner's People

Contributors

bullrich avatar lvgrecords avatar

Stargazers

EremesNG avatar Artem Sukhliak avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

unityfoldercleaner's Issues

Add support of Unity 2020.1.x

Current implementation is not working properly on Unity 2020.1.x (in my case Unity 2020.1.17f1).

AssetDatabase.Refresh(); cause next warning

A meta data file (.meta) exists but its folder 'Assets/Plugins/DOTween' can't be found, and has been created. Empty directories cannot be stored in version control, so it's assumed that the meta data file is for an empty directory in version control. When moving or deleting folders outside of Unity, please ensure that the corresponding .meta file is moved or deleted along with it.
UnityEditor.AssetDatabase:Refresh()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.