One liner in the foreach

Doesn’t make any difference, but I like to make my code a bit more compact (assuming it doesn’t degrade readability).

For example:

weapon.gameObject.SetActive(weaponIndex == currentWeapon);

This allows us to do away with the if/else blocks.

3 Likes

If you find that line of code readable, feel free to use it. :slight_smile:

Privacy & Terms