• 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
Question by AngryBurritoCoder · Aug 22, 2014 at 02:03 PM · uiguiarrayinventoryinventory system

How to go around creating inventory with new GUI (4.6 Beta)?

I know how to make an inventory system using arrays and other methods, what im really asking is if anyone knows how to go around using the new gui system to display my array of objects in the gui. What functions are there to script with new gui ? Since i noticed the new gui is quite a bit different when talking scripting wise. please help , thanks

Comment

People who like this

0 Show 1
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 Artifactx · Jan 17, 2015 at 05:52 PM 0
Share

Here is a great tutorial, that shows you how to create an inventory with the new 4.6 UI: https://www.youtube.com/watch?v=KLaGkc87dDQ

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Alessio89 · Aug 22, 2014 at 03:15 PM

If you ever used nGUI you'll feel at home. Mostly. Basically you have various built-in gui elements which you can access from GameObject -> UI. Those have some basic functionality like showing images, texts, scrollbars, button and many more.

Every element has to be child of a Canvas. If no canvas are in the scene when you first create an element, a canvas will be created and the element will be parented to the canvas.

In the canvas you can choose from three different modes: Screen Space - Overlay, Screen Space - Camera, World Space. What this means is that you can choose to place your GUI on top of the scene OR in World coordinates (which is awesome, really).

To make an Inventory, you would need to code some sort of grid sorting yourself.

hint hint: the relation between an index value and the position in the grid is:

index = x + (y*gridWidth)

Now you want to head over here -> 4.6 UI Beginner tutorial and learn the basics of the system. Specifically you want to learn about ScrollRects and Masks.

Last thing: if you want to access all the new unity ui classess, you'll have to either specify a using statement like so

 using UnityEngine.UI;

or call every elements by namespaces like so

 UnityEngine.UI.Button button;

If you mess around with the system after watching the basic tutorial, you'll surely get a lot of stuff and will be able to ask more precise questions about the inventory system. :)

Comment
AngryBurritoCoder

People who like this

1 Show 2 · 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 Runemark · Aug 26, 2014 at 03:05 PM 2
Share

You don't have to write your own grid sorting, becouse there is a built in version. You can find it in Component/Layout/Grid Layout Group. I got only one problem with this, the size of the grid elements are not changing with the canvas.

avatar image Alessio89 · Aug 26, 2014 at 09:23 PM 0
Share

Oh now I feel stupid for writing my own grid sorting component. Meh. Good to know :D

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Which is better for an inventory system, Array or List? 0 Answers

How to start an inventory system? 2 Answers

GUI focus control - inventory system issue 1 Answer

scroll bar inventory with slot count for equip items 0 Answers

Click on a button that is created post start. 0 Answers


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