Grabbing PlayerPref float and checking it's value?

Hi, I’m trying to create a system where objects in levels would be enabled/disabled depending on PlayerPref values.

using UnityEngine;
using System.Collections;

public class GameStateReaction : MonoBehaviour {
	public GameObject ObjectToEnableAfterGamestate;
	public string PlayerPrefToCheck;
	private float GameStateToReactTo;

	void Start ()
		PlayerPrefs.GetFloat(PlayerPrefToCheck) = GameStateToReactTo;

	void FixedUpdate () 
		if(GameStateToReactTo = 1f)

change this if(GameStateToReactTo = 1f) to if(GameStateToReactTo == 1f)

First of, you cannot assign a value to the return value of a PlayerPrefs.GetFloat call.
Line 11, makes no sense, you need to swap those variable’s place.

GameStateToReactTo = PlayerPrefs.GetFloat (PlayerPrefToCheck);

Line 16, you’re not checking if its equal to 1, you are assigning it to 1. It should look like this :

if(GameStateToReactTo == 1f)

Line 18, SetActive is a method of GameObject, not a property. You cannot “assign” method calls, you call them. It should look like this :

ObjectToEnableAfterGameState.SetActive (true);

By the overall look at your design, there is a lot of VERY BASIC programming knowledge that either flew waaaaaay above your head, you totally disregarded as being not important, or simply didn’t care to learn at all.

I can understand that Unity makes you feel like it’s very easy to make a game, but you need at least grasp the basic in programming (note that I wrote programming, not game programming). You can’t make a game without programming. You can’t. Never.

I’d strongly advise to go through a lot of basic C#/UnityScript tutorials before undertaking any kind of game. If not, you will have to bend over at any bug encounter, since you’ll have no idea what’s going on (like that very case of yours). Plus, this is entry level programming bugs (syntax bugs) and you can’t even figure that out, so you’re going to have a very bad time when encountering logic bugs…

Take the time to learn how to crawl before trying to do a double back flip. Game programming takes time and effort, not an answer from a stranger as soon as we stumble onto a pebble on the road