void ModifyMonster(string monsterType, GameObject monsterInstance) { Monster monsterScript = monsterInstance.GetComponent <Monster>(); MonsterHealth health = monsterInstance.GetComponentInChildren <MonsterHealth>(); NavMeshAgent monsterNMA = monsterInstance.GetComponent <NavMeshAgent>(); Renderer[] monsterRenderers = monsterInstance.GetComponentsInChildren <Renderer>(); // get the info for (int i = 0; i < monsterInfo.Length; i++) { if (monsterType == monsterInfo[i][MONSTER_NAME]) { // set the score monsterScript.Score = int.Parse(monsterInfo[i][MONSTER_SCORE]); // set the health health.setHealth(int.Parse(monsterInfo[i][MONSTER_HEALTH])); // set the speed monsterNMA.speed = int.Parse(monsterInfo[i][MONSTER_SPEED]); // set the color for (int j = 0; j < monsterRenderers.Length; j++) { if (monsterRenderers[j].name != "HealthBar") { Color color; ColorUtility.TryParseHtmlString(monsterInfo[i][MONSTER_COLOR], out color); monsterRenderers[j].material.SetColor("_Color", color); } } } } }