public void WormBoost(string boost) { //tokenize string string[] str = boost.Split(' '); int worm_no = int.Parse(str[0]); for (int i = 0; i < worm_no; i++) { if (WormsList[i] != null) { HeadController headController = WormsList[i].GetComponent <HeadController>(); if (bool.Parse(str[i + 1])) { headController.boost_enable(); } else { headController.boost_unable(); } } } }