UCE0001: ';' expected. Insert a semicolon at the end.
import UnityEngine.UI;
static var CurrentAmmo : int;
var InternalAmmo : int;
var AmmoDisplay : GameObject;
static var LoadedAmmo int;
var InternalLoaded : int;
var LoadedDisplay : GameObject;
function Update () {
InternalAmmo = CurrentAmmo;
InternalLoaded = LoadedAmmo;
AmmoDisplay.GetComponent.<Text>().text = "" + InternalAmmo;
LoadedDisplay.GetComponent.<Text>().text = "" + InternalLoaded;
}
That is my script, copied from "How To Make An FPS In Unity 5 Tutorial - Beginners - Part 009. I cannot spot a single erroe, however I am a newbie to unity, so help would be appreciated.
Post the complete error from console. And please, use the site's code formatter for posting your code.
The code is missing its class wrapper. After the import statement there need to be:
public class ClassWithScriptFileName : $$anonymous$$onoBehaviour {
and at the end put another {
Actually this looks like Unityscript to me. This doesn't require a class declaration.
Thanks for all the fast answers guys, but tanoshimi ended up fixing it for me. Very noob mistake I know.
Answer by tanoshimi · Nov 04, 2016 at 12:32 PM
Line 7.
static var LoadedAmmo int;
should be:
static var LoadedAmmo : int;
Thanks alot. I am new, only starting about a week ago and was completely stumped.
Your answer
Follow this Question
Related Questions
Assets Folder Appearing to be Empty 2 Answers
Errors With Game Over Script 1 Answer
Nav Mesh Problem with SetDestination 1 Answer
Advertising 0 Answers