Hello everyone, I’ve got a situation where I need to check an objects tag to determine what type of “surface”/material the object represents so I can play a sound when the player lands on it. It is simple enough, but, due to the way the tag structure is set up, I am ending up with very long IF statment conditions
ex:
else if (other.gameObject.tag == "tag1" || other.gameObject.tag == "tag2"|| other.gameObject.tag == "tag3"|| other.gameObject.tag == "tag4" || other.gameObject.tag == "tag5")
{
if (!audioSource.isPlaying)
{
audioSource.clip = RandomizeAudioClip (landingHardSurfaceArray);
audioSource.Play();
}
}
So I was wondering what the smarter / cleaner way of doing this would be. Any suggestions are appreciated