static bool forParticleSystem(GameObject go, ParticleSystemAction func) { ParticleSystem particleSystem = go.GetComponent <ParticleSystem>(); bool b = false; if (particleSystem != null) { b = func(particleSystem) || b; } Transform trans = go.GetComponent <Transform>(); for (int i = 0; i < trans.childCount; i++) { b = forParticleSystem(trans.GetChild(i).gameObject, func) || b; } return(b); }
static void ParticleSystemProcess(ParticleSystemAction func) { Object[] objs = Selection.GetFiltered(typeof(GameObject), SelectionMode.DeepAssets); int n = objs.Length; Selection.objects = new Object[0]; for (int i = 0; i < n; i++) { GameObject go = objs[i] as GameObject; string path = AssetDatabase.GetAssetPath(go); Debug.LogFormat("reimport {0}/{1}: {2}", i + 1, n, path); if (forParticleSystem(go, func)) { AssetDatabase.ImportAsset(path); } } }