This commit is contained in:
2025-09-17 18:56:28 +08:00
commit 54c72710a5
5244 changed files with 5717609 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
public class MoveToAssetsFolder
{
const string FirstTimeKey = "MOVE_SCRIPT_TEMPLATES_HAS_RUN";
const string targetFolder = "ScriptTemplates";
const string targetPath = "Assets/ScriptTemplates";
static MoveToAssetsFolder()
{
if (!SessionState.GetBool(FirstTimeKey, false))
{
FindAndMoveScriptTemplatesFolder();
SessionState.SetBool(FirstTimeKey, true);
}
}
static void FindAndMoveScriptTemplatesFolder()
{
string[] guids = AssetDatabase.FindAssets(targetFolder, null);
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
// Check if it's a folder and not some random asset
if (AssetDatabase.IsValidFolder(path))
{
// Ensure exact match of the name and that it's not in the Assets folder already
string folderName = System.IO.Path.GetFileName(path);
if (folderName == targetFolder && !path.StartsWith(targetPath))
{
AssetDatabase.MoveAsset(path, targetPath);
Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, $"Moved {targetFolder} to Assets folder.");
}
}
}
AssetDatabase.Refresh();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e383132f744a8c1448807b71fa31f7ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: