Else if / to switch

Hello. Can you update this code to switch or smth else. Thanks

if(col.tag == "Enemy") 
		{
			col.gameObject.GetComponent<TestEnemy>().Hurt(Damage);

			//Destroy Projectile
			Destroy(gameObject); 
		} 
		else if(col.tag == "BlackFlying") 
		{
			col.gameObject.GetComponent<BlackFlying>().Hurt(Damage);
			
			//Destroy Projectile
			Destroy(gameObject);
		}
		else if(col.tag == "FioletHuynya") 
		{
			col.gameObject.GetComponent<FioletHuynya>().Hurt(Damage);
			
			//Destroy Projectile
			Destroy(gameObject);
		}
		else if(col.tag == "Ship1_3") 
		{
			col.gameObject.GetComponent<Ship1_3>().Hurt(Damage);
			
			//Destroy Projectile
			Destroy(gameObject);
		}

Next time please give more detail with your issue, but I think your having issues with multiple else if’s functions. I believe with most coding languages in normal and unity can only use one else per if function.

So I think if you replace every other else if with a if function than it should work.

if(col.tag == "Enemy") 
       {
         col.gameObject.GetComponent<TestEnemy>().Hurt(Damage);
 
         //Destroy Projectile
         Destroy(gameObject); 
       } 
       else if(col.tag == "BlackFlying") 
       {
         col.gameObject.GetComponent<BlackFlying>().Hurt(Damage);
 
         //Destroy Projectile
         Destroy(gameObject);
       }
        if(col.tag == "FioletHuynya") 
       {
         col.gameObject.GetComponent<FioletHuynya>().Hurt(Damage);
 
         //Destroy Projectile
         Destroy(gameObject);
       }
       else if(col.tag == "Ship1_3") 
       {
         col.gameObject.GetComponent<Ship1_3>().Hurt(Damage);
 
         //Destroy Projectile
         Destroy(gameObject);
       }

I am not sure if this was your issue because I didnt fully understand your problem more detail would help…

Code not tested but will most likely work