How do you create a tower/building/unit UI panel in Unity 5
Hi,
What is the best approach to creating a Tower defense UI in the post Unity 5 GUI? I realize this is a huge question, so I'll break down what I'm trying to accomplish. Here's an example from kingdom m rush: https://www.youtube.com/watch?v=QeQbZXRh1_o
What I'd like to do is open a panel of build options when the player clicks on a spot that is currently open. To do this I did the following:
Created a sprite and attached a 2D Collider to capture a user click
Added a script to hold an array of 'towers' Gameobject
Created a prefab of a worldspace canvas that would be a child of the open sI ot object
Assign the gui prefAb to that object
Set the gui prefab gameObject to true
Assigned the gui llbuttons to a method called builld tower. this method is inside the open spot script
Each build button has an int as an argument which detemines which tower is instantiated
When the build buttoin is clicked, this tower is placed on the the open spot sprite
This works when the Gui object is already in the scene, but when I instantiate the gui from a prefab, thew buttons lose thier click event. I assume I'm doing a lot wrong.
1)Are there any tutorials that show how to create a UI for a strategy game? 2) What is the best approach to handling mulitple discrete ui objects in this system?
This is probably really confusing, and I'm thinking myself into a logic circle. Please let me know if this can be clarified.
Your answer
![](https://koobas.hobune.stream/wayback/20220612063958im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUI Text Background Box? How? 0 Answers
Help in changing the GUI looks! 0 Answers
Is there a way to ignore touch through a GUI button? 0 Answers