I'm using Visual Studio 2010 Pro to write some script for a horror game that I am making, but when I try to enter the word "Flashlight" in Flashlight.BatteryLife, Flashlight is underlined in red saying that it doesn't exist in the current context. The word "Flashlight" should be a light blue when I add a period after it. I'll post my code. Please help!
using UnityEngine;
using System.Collections;
public class HUD : MonoBehaviour
{
public static int BatteryCount;
public static bool HasFlashlight;
void OnGUI()
{
if (HasFlashlight)
{
GUI.Label(new Rect(10, 10, 80, 30), "Flashlight");
GUI.Label(new Rect(70, 10, 80, 30), Flashlight.BatteryLife.ToString("F2"));
}
}
}
↧