- Put these scripts to "Assets/Editor" folder
- Enable in context menu "Help" -> "Toggle asset import log"
Created
March 28, 2022 07:14
-
-
Save CSaratakij/920ad62438bebf75a31869b978b3a87b to your computer and use it in GitHub Desktop.
Asset Import Logger (for re-import issue)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
public class AssetImportLogger : AssetPostprocessor | |
{ | |
public const string IS_ENABLE_KEY = "KEY_ASSET_IMPORT_LOGGER_IS_ENABLE"; | |
public const string IS_START_KEY = "KEY_ASSET_IMPORT_LOGGER_IS_START"; | |
public const string LOG_FORMAT = "path '{0}'"; | |
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) | |
{ | |
bool isEnable = EditorPrefs.GetBool(IS_ENABLE_KEY, false); | |
if (!isEnable) | |
{ | |
return; | |
} | |
bool isStart = EditorPrefs.GetBool(IS_START_KEY, false); | |
if (isStart) | |
{ | |
EditorPrefs.SetBool(IS_START_KEY, false); | |
//Debug.Log("============================================="); | |
} | |
} | |
private void OnPreprocessAsset() | |
{ | |
bool isEnable = EditorPrefs.GetBool(IS_ENABLE_KEY, false); | |
if (!isEnable) | |
{ | |
return; | |
} | |
bool isStart = EditorPrefs.GetBool(IS_START_KEY, false); | |
if (!isStart) | |
{ | |
EditorPrefs.SetBool(IS_START_KEY, true); | |
Debug.Log("=============== Asset Import Logger ==============="); | |
} | |
Debug.Log(string.Format(LOG_FORMAT, assetPath)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment