Search Unity

My Inventory not working.

Discussion in 'Scripting' started by XPGamingXPDK, Oct 20, 2014.

  1. XPGamingXPDK

    XPGamingXPDK

    Joined:
    Sep 3, 2014
    Posts:
    10
    I cant use inventory the fail is, Assets/Scripts/Inventory.js(29,1): BCE0044: expecting EOF, found ´}´,.
    My script is.

    #pragma strict

    var speed = false;


    function Start () {

    }

    function Update () {

    if(Input.GetKey("e") ) {


    if(opned == false) {

    opned = true;

    }else {

    opned = true;

    }

    }

    }

    }

    function OnGUI () {


    if(opned == true) {

    GUI.Box(Rect(300,30,500,300), "Inventory");

    }
    }
     
  2. DylanYasen

    DylanYasen

    Joined:
    Oct 9, 2013
    Posts:
    50
    first of all EOF means "end of file", this error is usually thrown when you've forgotten an ending curly brace for a block of code
    since you didn't use code block, it is just so messy to read. You may want to double check your code.

    for the logic in update you can use
    Code (CSharp):
    1. bool opened = false;
    2.  
    3. void Update(){
    4. if(Input.GetKey("e") ) {
    5.     opened = !opened;
    6. }
    7. }
    this might be neater to use
     
  3. Zaladur

    Zaladur

    Joined:
    Oct 20, 2012
    Posts:
    392
    Please use code tags. The error statement means you have an extra closing bracket in your code, as it was expecting the file to end (EOF), but found an extra closing bracket.

    With proper formatting and indentation, these errors should be very very easy to identify and correct, even if your editor isn't that great.
     
  4. XPGamingXPDK

    XPGamingXPDK

    Joined:
    Sep 3, 2014
    Posts:
    10
  5. XPGamingXPDK

    XPGamingXPDK

    Joined:
    Sep 3, 2014
    Posts:
    10
    But how can i use the things to the Inventory?