Yes, if each value gets its own bit.

The problem
A bool for every unlock.
public class Abilities{ public bool CanJump; public bool CanDash; public bool CanGlide; public bool CanWallRun; // ...and one more every update}
Every new unlock is a new field, a new thing to save, a new check.
The fix
One bit per ability.
Give each value its own power of two. Then any mix of them fits in one number.
Jump 1|Dash 2=3
The fix in code
Add with OR. Check with AND.
[Flags]public enum Ability{ None = 0, Jump = 1, Dash = 2, Glide = 4, WallRun = 8} Ability _have = Ability.Jump; _have |= Ability.Dash; // unlockbool canDash = ( _have & Ability.Dash ) != 0; // check
One field, one number to save. [Flags] even makes it print as "Jump, Dash".
Watch out
Powers of two, or it breaks.
Let the values count 1, 2, 3, and Jump plus Dash looks exactly like Glide.
- 1, 2, 4, 8
- each bit on its own
- 1, 2, 3
- Jump + Dash is 3
- None
- always 0
The rule
A set of switches? Use [Flags].
- Values
- 1, 2, 4, 8
- Turn on
- x |= Ability.Dash
- Check
- ( x & Ability.Dash ) != 0