Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by BVargas · Oct 08, 2010 at 06:58 PM · errorsyntax-erroruce0001

Making it display a Gui

I am making a inventory for my game. This is part of my coding...

function Update () 
{
    Input.GetButton(Inventory)
        show.inventoryGui;
}

I typed that in and have the Inventory input set up and it gives me this error

Assets/Scripts/CharacterSave.js(50,35): UCE0001: ';' expected. Insert a semicolon at the end.

If you have any help at all please post...

Thanks in advance for anyone that helps me with this...

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by skovacs1 · Oct 08, 2010 at 07:37 PM

you like ellipses...

Is Inventory a button or a type?

Input.GetButton() takes a String defining a button configured in your input manager.

If you have defined a button Inventory, then you probably wanted

Input.GetButton("Inventory")

If you want the code to only act when the button is held down, you probably wanted

Input.GetButtonDown()

If you wanted the inventory thing to only happen when the Input.Get... was true, then you should put it inside of an if statement

if(Input.GetButtonDown("Inventory"))
    //show your GUI

What is show supposed to be? If show is an enum, class or class instance, then this is syntactically correct, but will not actually do anything.

What is inventoryGui supposed to be? If it is a variable of a class, then you should be assigning or changing it like show.inventoryGui = something;. If it is an enum, then you should be assigning something to have its value like something = show.inventoryGui;. If it is a function, you must call it with parentheses like show.inventoryGui();.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by stevesterrr · Jul 24, 2012 at 12:53 PM

  1. var button : boolean;

    1. function Update()

    2. {

    3. //if user presses Tab then the GUI should appear;

    4. if (Input.GetKeyDown(KeyCode.Tab))

    5. {

    6. button = true;

    7. }

    8. //if he's not pressing Tab anymore let's make the GUI dissapear;

    9. if (Input.GetKeyUp(KeyCode.Tab))

    10. {

    11. button = false;

    12. }

    13. }

    14. //now let's make our GUI;

    15. function OnGUI()

    16. {

    17. if (button == true)

    18. {

    19. // you can change the values and the text displayed as you wish;

    20. GUI.Box (Rect (100,100,100,100), "it works" );

    21. }

    22. }

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image stevesterrr · Jul 24, 2012 at 01:02 PM 0
Share

add it to your player or camera and it should work ;)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Lerpz tutorial multiple errors.HELP!!!! 4 Answers

Scripting Error when drawing texture to custom window; What am I doing wrong? 1 Answer

Limit rotation for a statue puzzle 1 Answer

Semicolon? WHAT? HELP ME! 1 Answer

Collision Detector script 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges