- Home /
Question by
StickyDream · Aug 11, 2013 at 03:28 PM ·
c#errorflashlighthorror
Error with Hud C# script
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"));
}
GUI.Label(new Rect(10,40,80,30), "Batteries" );
GUI.Label(new Rect(70,40,80,30), BatteryCount.ToString());
}
}
//The Error i get says This Assets/HUD.cs(9,12): error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration
//and i dont know how to fix it :/
Comment
Best Answer
Answer by ArkaneX · Aug 11, 2013 at 03:35 PM
You lack ; after
public static bool HasFlashlight
Your answer
![](https://koobas.hobune.stream/wayback/20220613111958im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How do I make a power out on my flashlight? 1 Answer
How can i make this animation play only once? C# 1 Answer
Unity Editor & iOS - Download MP4 to Streaming Assets Folder 0 Answers