79587070

Date: 2025-04-22 17:02:14
Score: 1.5
Natty:
Report link

Create a dictionary with key int and value of string and store it via some ScriptableObject that is accessible to your scripts. Key should be biome ID and value should be BiomeText.

See: https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-9.0

Then access the dictionary instead.


int currBiome = i
...
skyPreviousBiomeType.Text = biomes[currBiome-1];
skyBiomeType.text = biomes[currBiome];
skyNextBiomeType.text = biomes[skyBiomeType+1];

Obviously, this is not a bulletproof solution.
You would preferably need to check if the key is in the dictionary and if not, apply some other custom logic of your choice to select the Biome.
Example problem could occur when your currBiome is 1; what would be the previous Biome then? Do you stay at 1 or does it underflow into 8?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Karol HaliƄski