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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by alkaloid · Apr 21, 2013 at 01:43 PM · guitableguiscript

GUI Table View In Unity

I want to ask if unity supports table view control something like this* which has been made in JavaFX.

http://s12.postimg.org/reimjc8gr/table_View.png

http://s18.postimg.org/b2g47ql8p/table_edit.png

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

5 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by MylesLambert · Apr 21, 2013 at 02:12 PM

You would need to look at creating this yourself using the existing GUI labels. It shouldn't be too hard depending on how many features you need.

  1. Consider the method to store the data. If you need something quite dynamic I'd suggest a list of a class that contains all the variables you need. Like this:

    public class variablecontainer : Object { public string firstname, lastname; public byte age; }

    List containerList = new List();

  2. To display this data just use a for loop with a bunch of labels containing the data you need to display.

      private void drawsingleline (int pos, variablecontainer toShow) {
             GUI.Label(new Rect(0,pos*32, 128,32), toShow.firstname);
             GUI.Label(new Rect(128,pos*32, 128,32), toShow.lastname);
             GUI.Label(new Rect(256,pos*32, 128,32), toShow.age.ToString());
         }
         
         private void drawTable () {
             int i = 0;
             foreach (variablecontainer thecont in containerList) {
                 drawsingleline(i, thecont);
                 i++;
             }
         }
    
    

Obviously you will need to go a lot further to make this nice and functional. But it should give you a head start :)

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 fafase · Apr 21, 2013 at 03:37 PM 0
Share

You would have to put all that in a OnGUI method or you will not see any labels or buttons

avatar image
1

Answer by bourriquet · Mar 18, 2019 at 10:35 PM

I developed this plugin for this usage. You just have to give it a collection and select the properties for the columns and it will draw the table automatically.

I hope it helps!

https://assetstore.unity.com/packages/tools/gui/ui-table-137867

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 slumtrimpet · Nov 25, 2015 at 03:38 PM

Shameless Plug: TablePro is available for Unity 5+ and does this plus a lot more now out of the box: http://u3d.as/ipR

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 tungnguyendev · Jan 20, 2018 at 02:59 PM

https://www.youtube.com/watch?v=UtPYR4EoXKc Hope this help!!!

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 Bunny83 · Jan 20, 2018 at 04:13 PM 0
Share

If you are the developer of this table view you should add a direct link to your git repository as link chains are generally a bad idea. If something happens to the YT video this answer would be useless.


You also should add a license otherwise people will not use your script as it's not clear what is allowed. You also should clean up your scripts. Removing empty Start and Update methods will increase the performance (especially in your UITableViewCell script). Each existing Start and Update methods need to be called by the engine. If you remove them Unity won't even try calling it.

avatar image
0

Answer by IgorZ · Jun 19, 2021 at 10:40 PM

I ended up developing my own class that draws the table based on GUI.Label. When you can specify fixed widths for the columns it's trivial, but when you cannot know in advance what would be the column width, then it's a challenge. In my class what I do is collecting strings and calculating their width in the Layout phase. Then, in the Repaint these widths are used to draw the properly aligned and scaled table.

Here is the code. Usage:

   GUILayoutStringTable _guiTable = new GUILayoutStringTable(4, keepMaxSize: true);
 
   void OnGUI() {
     for (var i = 0; i < 10; i++) {
       _guiTable.StartNewRow();
       using (new GUILayout.HorizontalScope()) {
         _guiResourcesTable.AddTextColumn("column1", GUI.skin.button);
         _guiResourcesTable.AddTextColumn("column2", GUI.skin.button);
         _guiResourcesTable.AddTextColumn("column3", GUI.skin.button);
         _guiResourcesTable.AddTextColumn("column4", GUI.skin.button);
       }
     }
   }

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

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

18 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

Related Questions

how will i get every time values in table window? 0 Answers

Change Font Size of GUI Table 0 Answers

Passing values every time to table? 0 Answers

How to Load Dynamic Form Based on User Choice Selection 2 Answers

need help for Displaying Values? 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