So I have 3 variables that I want to access and they are in one script. I could make it from another script but I am really curious how to make it and the code wold be clearer and more sensible where I want it to be. I tried to do it like that:
enemyController = GameObject.FindGameObjectsOfType<>EnemyController>();
but then when I want to access these variables I can put only one number in these brackets: .
If you are curious what I’m doing and maybe it can make it clearer what I mean, then I want to decrease my player’s HP each time the enemy hits him. I have 3 enemies and 3 variables: hellephantDmg, bearDmg, bunnyDmg. The scripts EnemyController is attached to all three of them. I want to make if statement and detect which enemy player hits that’s why I want to access these 3 variables but the problem is I don’t know how… Please help.