public static void LevelUnlocked(int level){
the error box say "you can’t use the same members type"
but why?
full code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerPrefsManager : MonoBehaviour {
const string MASTER_VOLUME_KEY = "master_volume";
const string DIFFICULTY_KEY = "difficulty";
const string LEVEL_KEY = "level_unlocked_";
public static void SetMasterVolume(float volume)
{
if (volume > 0f && volume < 1f) {
PlayerPrefs.SetFloat(MASTER_VOLUME_KEY,volume);
}
else
{
Debug.LogError("master volume out of range");
}
}
public static float GetMasterVolume()
{
return PlayerPrefs.GetFloat(MASTER_VOLUME_KEY);
}
} // this brace is currently closing the class definition
// the following code is outside of the class definition
public static void LevelUnlocked(int level)
{
if(level <=Application.levelCount - 1)
{
PlayerPrefs.SetInt(LEVEL_KEY + level.ToString(),1);
}
else
{
Debug.LogError("level locked ");
}