GetComponent("script") HELP

hi guys,

There are way to do some like this?

GetComponent(scriptname.Cointains(“fight”));

I use one script for following the player and use other differents scripts for fight.

and each Bot have a fight script different but the script of following the player is the same.

I want to have the name of the script that have fight in name that are attached to the bot.

Thanks.

The way you could do this is by using GetComponents

Get all components of type MonoBehaviour and save them to an array. Then, go through each one, and test its name against “fight” as you’re doing now.