Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

error cs1525: unexpected symbol 'end of file'

Discussion in 'Scripting' started by mattydennis, Nov 8, 2017.

  1. mattydennis

    mattydennis

    Joined:
    Nov 8, 2017
    Posts:
    39
    error somewhere with void Update()


    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using System.Collections;
    4.  
    5. public class lives : MonoBehaviour {
    6.  
    7.     public Text Text;
    8.     public int life;
    9.  
    10.  
    11.  
    12.     void Start()
    13.     {
    14.         life = 10;
    15.         Text.text = "life: " + life.ToString ();
    16.     }
    17.     void Update() {
    18.         if (Input.Get) {
    19.            
    20.        
    21.     }
    22.  
    23.  
    24. }    
    Error in

    void Update() {
    if (Input.Get) {


    }


    }
     
  2. mattydennis

    mattydennis

    Joined:
    Nov 8, 2017
    Posts:
    39
    I add a bracket to the end of the script but then I get:

    Assets/Scripts/lives.cs(18,13): error CS0117: `UnityEngine.Input' does not contain a definition for `Get'
     
  3. Flynn_Prime

    Flynn_Prime

    Joined:
    Apr 26, 2017
    Posts:
    383
    Exactly as you say. Get is not defined within Input. See the link for the static variables of Input

    https://docs.unity3d.com/ScriptReference/Input.html
     
    mattydennis likes this.
  4. mattydennis

    mattydennis

    Joined:
    Nov 8, 2017
    Posts:
    39
  5. Flynn_Prime

    Flynn_Prime

    Joined:
    Apr 26, 2017
    Posts:
    383
    Not a problem. If you aren't sure which one you require, message here with what you want to achieve and I'll try to help.
     
  6. UziMonkey

    UziMonkey

    Joined:
    Nov 7, 2012
    Posts:
    206
    This error is almost always a missing semicolon.
     
  7. Flynn_Prime

    Flynn_Prime

    Joined:
    Apr 26, 2017
    Posts:
    383
    Not in this case...
     
  8. UziMonkey

    UziMonkey

    Joined:
    Nov 7, 2012
    Posts:
    206
    You're right, I actually meant to type brace. If you miss a semicolon, you get an error saying so. I had a brain fart, meant one thing and typed another.
     
  9. Flynn_Prime

    Flynn_Prime

    Joined:
    Apr 26, 2017
    Posts:
    383
    To be fair I overlooked the missed brace too! Even after he said he had added one... oh well, we both helped here :)