はじめに
「UnityBulkConverter」を Unity プロジェクトに導入することで
すべてのプレハブやシーン内のオブジェクトに対して
任意の処理を行うことができるようになります
使用例
すべてのプレハブに BoxCollider をアタッチ
using BulkConvertBatch; ... private static bool AddBoxCollider( GameObject go, string path ) { if ( go.GetComponent<BoxCollider>() != null ) return false; go.AddComponent<BoxCollider>(); return true; } [MenuItem( "Tool/AddBoxCollider" )] private static void Execute() { BulkConvertUtility.DoAllPrefab( AddBoxCollider, "AddCollider" ); }
すべてのシーンのすべてのオブジェクトの
RectTransform のサイズを縮小
using BulkConvertBatch; ... private static bool RectToSmall( RectTransform t ) { if ( t == null ) return false; t.localScale = t.localScale * 0.5f; return true; } [MenuItem( "Tool/RectToSmall" )] private static void Execute() { BulkConvertUtility.DoAllComponentsInAllScene<RectTransform>( RectToSmall ); }