Can this work this if statements

is it possible to use a PlayerPrefs to interact with other if statements other then for GUI. for example i have a hidden door that i only want to appear when the player has the right “key” which i have labeled as “unlockedLevel299”. here’s the code

using UnityEngine;
using System.Collections;

public class HiddinLevelSelect : MonoBehaviour {
	public string Levels = "Level?";
	public string UnlockKey = "KeyForNextLevel";

	// Use this for initialization
	void UpDate (){
		if (PlayerPrefs.GetInt ("unlockedLevel299") == 1){
			gameObject.renderer.enabled = false;
//			Destroy(gameObject);
			Debug.Log("door closed");
		else if (PlayerPrefs.GetInt ("unlockedLevel299") == 0){
			Debug.Log("door open");

	void OnTriggerEnter2D (Collider2D other) {
		if (other.tag == "Player"){	
			PlayerPrefs.SetInt (UnlockKey,1);
			Application.LoadLevel (Levels);

Yes, but maybe not too efficiently within your example; also watch your capitalization on Update (v. UpDate, as you have it). There is nothing “GUI”-ish about PlayerPrefs, at all.