Hey, im new to Unity and im trying to make a platformer, right now i am working on a “Unlock-System” and i had a good idea how to do that, but now i get an error : Assets/Scripts/Lock.cs(13,19): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class WinGame : MonoBehaviour {
//the "Back Button
public void gback()
{
//if you win you go back to the Level Selector
SceneManager.LoadScene ("LevelSelect");
}
//if you step into a Door you win
void OnTriggerEnter2D (Collider2D other) {
if (other.tag == "Player") {
SceneManager.LoadScene ("LevelSelect");
//i want that if you step into the door you will get to the Level Selector and then the next level is unlocked,
//"enable" is just a name for me to remember
PlayerPrefs.SetString("Level02Lock", "enable");
}
}
void awake(){
DontDestroyOnLoad (transform.gameObject);
}
}
And the other Script which is in another Scene
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Lock : MonoBehaviour {
public Button levelButton02Locked;
public Button levelButton02Unlocked;
void Start() {
if (PlayerPrefs.GetString("WinGame", "Level02Lock") = "enable"){
levelButton02Locked.gameObject.SetActive (false);
levelButton02Unlocked.gameObject.SetActive (true);
}
}
}