Never use a Switch Statement in Unity

Common rationale for a Switch/Case statement

Collecting a power up

The Switch Code Smell

Back to life, back to reality

  • When you read that something has an advantage, be honest with yourself, re-examine if you really believe it’s true
  • When you hear that “Switch’s are evil” or are asked in an interview “Why are they bad” you know that they’re not but they can encourage a poor design if you’re not careful

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store