2026-07-06 공룡에셋 추가
This commit is contained in:
61
Assets/02_Scripts/Editor/ReserializeAssetsTool.cs
Normal file
61
Assets/02_Scripts/Editor/ReserializeAssetsTool.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DinoLove.EditorTools
|
||||
{
|
||||
// 구버전 Unity(2019.1 이전)로 저장된 에셋을 현재 포맷으로 다시 저장한다.
|
||||
// 콘솔의 "Serialized files [version 17] before 2019.1 are deprecated. Open and re-save the file" 경고 해결용.
|
||||
internal static class ReserializeAssetsTool
|
||||
{
|
||||
// Unity가 직렬화하는 에셋만 대상 (FBX/텍스처 같은 소스 에셋은 해당 없음)
|
||||
static readonly string[] k_TargetExtensions =
|
||||
{ ".prefab", ".mat", ".controller", ".overridecontroller", ".mask", ".anim", ".asset", ".physicmaterial" };
|
||||
|
||||
[MenuItem("Tools/Reserialize Assets/Toon Dinosaurs 폴더")]
|
||||
static void ReserializeToonDinosaurs()
|
||||
{
|
||||
Reserialize(CollectFromFolder("Assets/Toon Dinosaurs"));
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Reserialize Assets/선택한 에셋 또는 폴더")]
|
||||
static void ReserializeSelection()
|
||||
{
|
||||
var paths = new HashSet<string>();
|
||||
foreach (var guid in Selection.assetGUIDs)
|
||||
{
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (AssetDatabase.IsValidFolder(path))
|
||||
paths.UnionWith(CollectFromFolder(path));
|
||||
else
|
||||
paths.Add(path);
|
||||
}
|
||||
Reserialize(paths);
|
||||
}
|
||||
|
||||
static IEnumerable<string> CollectFromFolder(string folder)
|
||||
{
|
||||
return AssetDatabase.FindAssets("", new[] { folder })
|
||||
.Select(AssetDatabase.GUIDToAssetPath);
|
||||
}
|
||||
|
||||
static void Reserialize(IEnumerable<string> candidates)
|
||||
{
|
||||
var targets = candidates
|
||||
.Where(p => k_TargetExtensions.Contains(Path.GetExtension(p).ToLowerInvariant()))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
if (targets.Count == 0)
|
||||
{
|
||||
Debug.LogWarning("[ReserializeAssetsTool] 재직렬화할 에셋이 없습니다. 폴더나 에셋을 선택했는지 확인하세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
AssetDatabase.ForceReserializeAssets(targets);
|
||||
Debug.Log($"[ReserializeAssetsTool] {targets.Count}개 에셋을 현재 직렬화 포맷으로 다시 저장했습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Editor/ReserializeAssetsTool.cs.meta
Normal file
2
Assets/02_Scripts/Editor/ReserializeAssetsTool.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9761e7f377da3a42af2cf6fac21e2d4
|
||||
Reference in New Issue
Block a user