100 OnTriggerEnter Or Tags each player too much?

Hello Unity3D.I have a question about the OnTriggerEnter and Tags.Is having 100 OnTriggerEnter and Tags on a player too much?The reason why i ask this question is the fact that i want to make the character that get hits depending on the tag that they character gets hit with plays a certain animation.For example.my character gets hit with a fireball and the fireball has a tag name fire.Therefore the character that gets hit with the fireball that is tagged fire the character plays animation called "fire hit"and if the character was hit with a water balloon and the water balloon was tagged water the character that got hit with the water balloon would play an animation called “water hit”.Is there a way that i can make one script that can play OnTriggerEnter that depending on the tags of the players or objects that the character gets hit with plays a certain animation depending on the tag.If so.Can anyone please tell me how?

P.S This is an example

#pragma strict

var setOnFire : ParticleSystem;
var player :Transform;
var speed = 30;
var pushPower = 2.0;
var anim: String;
var cam: Camera;

function OnTriggerEnter (Col : Collider)
 {
     if (Col.tag == "Fist")
     {
         // Default hit animation
         var anim : String = "Hit1";
         
         // Animation related to player's animation
         if(Col.animation.IsPlaying("Gigantic_FireBall_Part_2"))
         
          anim = "Shinzuroken_Hit";
         
     
         animation.Play(anim);
         cam.animation.Play("Hit Animation Camera");
         cam.animation["Hit Animation Camera"].speed = 2;
         setOnFire.Play();
     }
 }
 
 function OnTriggerExit (other : Collider)
 {
 		
 		if (other.tag == "Player")
 		{
 		cam.animation.Play("Normal Camera");

 		
 		
 		}
 		
}

So you want to have 100 scripts that have void OnTriggerEnter() defined in them and have all of those attached to one player, with 100 tags individually handled by the 100 scripts?

Yes, that is absolutely WAY too much and is certainly not now the Tag system was intended to be used.

Now, if you give an explanation of what exactly you’re trying to do, perhaps we can help you find a solution that is cleaner than 100 frivolous scripts and tags!

So what are you using to control your animations? If it’s an AnimatorController, then the naive approach would be to add a Boolean to it’s base layer for each animation you want to use. Then in the script on your fireball or whatever you could do this.

GameObject player;
Animator playerAnim;

void Start() {
     player = GameObject.FindGameObjectWithTag("Player");
     playerAnim = player.GetComponent<Animator>();
}

void OnCollisionEnter(Collision other) {
     if(other.gameObject.tag.Equals("Player")) 
     {
          // assuming you have an AnimationController with some
          // animation state that gets triggered when the 
          // layer's Boolean Burning is true.
          playerAnim.SetBool("Burning", true);
     }
}

With this, the things you are hitting the player with don’t even need tagging.

It’s not a good way of doing things. A much better idea would be to have your projectile have an OnTriggerEnter script that checks if it hits a player, and if it does informs the player that it was hit by a projectile and passes the relevant information about what kind of projectile it is and what animations it should play in response.

Something like

void OnTriggerEnter( Collider other)
{
 if(other.CompareTag("Player")
 {
     PlayerController pController = other.GetComponent<PlayerController>();
     if( pController != null)
     {
            pController.HitByProjectile( this.projectileDamage, this.ProjectileType)

     }
 }

}