(Like in Hollow Knight that the player need to collect the abillity to dash or double jump)
In your movement script:
bool canJump = false;
void Update()
{
canJump = PlayerPrefs.GetInt("hasJumpAbility") == 1;
}
void Jump()
{
if(!canJump){ return; }
else
{
//do the jump code here
}
}
in some player script (even movement is you want)
OnTiggerEnter(Collider other)
{
if(other.CompareTag("Item"))
{
if(other.gameObject.name == "JumpAbility")
{
PlayerPrefs.SetInt("hasJumpAbility",1);
PlayerPrefs.Save();
}
}