Question by
KrmGND · Apr 29, 2018 at 11:33 AM ·
unity 5playerprefs
The type or namespace name `Stage1' could not be found. Are you missing a using directive or an assembly reference? Help???
using UnityEngine;
using System.Collections;
public class kayıt : MonoBehaviour {
float playerScore = 0;
public float guiPlacementY1;
public float guiPlacementX1;
Stage1 player;
void Start()
{
player = GetComponent<Stage1>();
}
public void IncreaseScore(int amount)
{
playerScore += amount;
}
public void DecreaseScore(int amount)
{
playerScore -= amount;
}
void OnDisable()
{
PlayerPrefs.SetInt("Score", PlayerPrefs.GetInt("Score",0) + score);
PlayerPrefs.SetString("PlayerName", "High Score");
PlayerPrefs.Save ();
Debug.Log("Saved");
}
void OnGUI()
{
GUI.Label (new Rect(Screen.width * guiPlacementX1, Screen.height * guiPlacementY1, Screen.width * .5f, Screen.height * .4f), "Score: " + (int)(playerScore * 5));
}
}
,
Comment
What does Stage1 derive from? Is it a monobehaviour, or something else? Does the beginning of it look like this: using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Stage1 : $$anonymous$$onoBehaviour {
Your answer
![](https://koobas.hobune.stream/wayback/20220612161719im_/https://answers.unity.com/themes/thub/images/avi.jpg)