Unity 5 UI Server List
Hello i wanted some help regarding making a server list for my game
Currently i use Gui.Layout for making the UI buttons,labels and stuff which works fine for the server list
But how to do it with the canvas? i want to make it sci-fi How to do it without using Gui.Layout methods?
I mean the UI should automatically add new buttons when a server is found So we should have a connect button for every server found Also when multiple servers are found it should add new lines for the server name and new button for every new server found Like a server list How can i do it?
For example something like this
Answer by Firedan1176 · Aug 01, 2016 at 01:21 AM
The way I found that works well is to create a single button using the prefabs Unity creates when you go to GameObject > UI > Button/Image/etc. Make a single "panel" (with the text, buttons, etc) and make it a prefab. Make a panel , add a vertical layout group to it, and add a script that simply makes those prefabs children of it when they are matched. The vertical layout group should space them how you want. However, it may make them anchored towards the center. You may need to do some more research if that's the case. Anyways, once you instantiate them, simply find the child GameObjects for each text component and change the text to the desired output. You could also make a script that will store those GameObjects on your button. Then you can simply grab that script, and instantly have access to those fields for the text components. Since "Mode", "Map", etc. are all used, you can simply just make those the names instead of worrying about making an array or anything.
Let me know how this works out for you. Feel free to leave a comment if you need more explanation/assistance.
Thank you very much for your answer I understood the concept but i dont know how to implement it properly Do you have any tutorial videos? Or any tutorial post? that could help more
Anyways great help , gave me a new idea Thanks!