Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: iHaveReturnd on July 03, 2013, 03:47:31 PM
-
Is there a way to change a popup list's contents at runtime? I'm working on a networked game currently, and we are having players type in an input, receiving it, then wanted to put it into the popup list.
Right now I have it set up so that the "items" list in the UIPopup.cs script updates to contain the user input, but the UI doesn't update. The options field adds the input I gave for the popuplist item. But I can't open the dropdown menu when it does this, so it's like theres no values in it or I've broken the functionality. Is there a better way to do this or is it achievable?
If what I'm asking is unclear at all let me know and I'll try to explain better or add some screenshots.
-
UIPopupList.items contains the list of items. What's the issue are you having? It not updating? I can only see it not updating if the popup list is currently open when you change its items list.
-
I've reworked it a little. The current state is the popup list will update based on player input, however there are two problems with it.
The first is that the currently displayed item on the popup list only updates if I click on the Popup List item in the Unity inspector. So if it was blank before, I have to click that to make it show in game, which can't normally be done in a game.
The second problem is that the popup list doesn't open the dropdown menu when clicked, regardless of how many items are in it. The items list starts with 0 items. It is populated only by the input. I do have 2 cameras in the scene, with the ngui ui camera being at a higher depth level than the other camera. (Main camera depth = 0, ngui camera = 1)
Any thoughts on how to resolve this?
EDIT: It may also be important to note that on Start, I am disabling the label and sprite for each popup list, then if the player hits a button, it enables them for that player, and not the others. Doing this step through NGUITools.SetActive.
Another edit. I just deleted the popup lists I had, and made a new one. That one seems to be working, so I guess I broke something along the way with the old one. I'll retry the setup with the new popup list and see what happens.
Last edit: I believe I got it all working now. Just broke something a long the way I guess, the new popup lists work fine.
Thanks for the help ArenMook