Updating and redrawing list objects - How?
Hi! I have a scrollview with a list of button prefabs, simulating a lobby with team members. Every button prefab represents a team member. The amount of buttons that shall be created in the scrollview (the list.Count) is determined by a php server adress that is fetched. This php server adress is fetched inside an IEnumerator method. After this I populate the actual list with list.Count (from IEnumerator) amount of button prefabs.
As Im creating a lobby and need to constantly check weather members are joining or leaving, I need to loop the IEnumerator server method, and the list populating method.
In the populating method Im creating RectTransforms and setting the scrollview transform as parent and setting the button's texts to the names of the team members.
The only problem Im having is that whenever Im trying to loop these methods to check if any team member has joined of left (if one more button should be added or removed), it doesnt acct the way I want it too.
Either I get a duplicate of the button(s) I already have, or it doesnt update the amount of buttons at all. I really need this to work. Why inst? this working?
My code is here:
Your answer
Follow this Question
Related Questions
How to add prefab children to a list in unity 0 Answers
Scroll-view Database 0 Answers
Adding prefab objects to a list on another script and object? 2 Answers