https://docs.unity3d.com/ScriptReference/AssetPostprocessor.OnPostprocessPrefab.html
Unity - Scripting API: AssetPostprocessor.OnPostprocessPrefab(GameObject root)
To use this function, add it to a subclass. It lets you modify the imported GameObject. GameObjects only exist during the import and Unity destroys them immediately after import. This function is called before the final Prefab is created and before it is w
docs.unity3d.com
2020.3 버전
using UnityEngine;
using UnityEditor;
// Adds a mesh collider to each game object that contains collider in its name
public class Example : AssetPostprocessor
{
void OnPostprocessPrefab(GameObject g)
{
Apply(g.transform);
}
void Apply(Transform t)
{
if (t.name.ToLower().Contains("collider"))
t.gameObject.AddComponent<MeshCollider>();
// Recurse
foreach (Transform child in t)
Apply(child);
}
}
'Unity > 기타' 카테고리의 다른 글
애플 개인정보 정책 변경 (0) | 2024.02.26 |
---|---|
패키지 메니저에서 "com.google.external-dependency-manage" 가 다운 되지 않는 현상 (0) | 2021.06.22 |
OnPointerClick 관련 이것저것. (0) | 2021.05.12 |
즐겨찾기-최적화 (0) | 2020.12.13 |
코드로 Player Settings 창 열기 (0) | 2020.06.02 |