When I implemented IsLevelUnlocked, firstly, I used a very optimistic approach (no incorrect level numbers entered) which was probably not the best idea. But also, I just used the HasKey() method for PlayerPrefs:
public static bool IsLevelUnlocked(int level) {
return PlayerPrefs.HasKey(LEVEL_UNLOCKED_KEY + level.ToString());
}
My thinking was that HasKey() returns a Boolean and also that the value stored against the particular key isn’t very interesting in this case. It doesn’t look like we’re planning to change the value from 1 to 0. It looks more like the key will exist or it won’t.
My question is - is my logic actually sound? Or is this an idea likely to backfire later?