• 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
1
Question by Twiddlesnap · Mar 19, 2015 at 09:44 PM · nguitable

NGUI table does not Reposition() properly

I have a table in a scrollview which I dynamicly fill from code. I iterate through an array of dataobjects, filling the data into a prefab-widget. All works so far. After the elements are all in the table I call the Reposition-method, but it is not properly executed. The paddinge between the elements in the table is much wider than I have set it. The only ways to properly Reposition() the tables elements I have found so far are a) right-clicking the table and chosing "execute" from the context-menu and b) adding Reposition() to the update-function having it execute every frame (sounds like a bad idea considering performance?)

What I tried so far: - putting Reposition() in Update() with a boolean/if-condition that makes it execute only once - trying the same as above with LateUpdate() I have not had any success so far. The Functions themselves seem to work, but they seem to have no effect on the table.

 for(int i = 0; i < _items.Length; i++)
 {
 
     var itemInstance = NGUITools.AddChild(ItemsPanel, ItemPrefab);
     var item = itemInstance.GetComponent<PrefabScript>();
     item.Icon.SetTexturePath = _items[i].IconPath;
     item.Level.text = _items[i].text;
     item.NotPresent.SetActive(_items[i].CurrentWeapon);
 }
 
 // make table sort itself
 // it doesn't work properly, no clue why
 ItemsPanel.GetComponent<UITable>().Reposition();
 


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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SuperbStarling42 · Jan 05, 2018 at 12:18 PM

I now have the same issue. Did you find a solution to this?

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 fbittner · Nov 20, 2018 at 10:12 AM 0
Share
 table.repositionNow = true;

worked for me.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

For in a hash table 1 Answer

How could I store negative coordinates with negative indexes with C#? 1 Answer

Problems using NGUI for in-game options sliders 0 Answers

ngui only displays pink boxes (embedded graphics problem?) 0 Answers

NGUI finding texture width/height ingame 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges