Hey ArenMook,
I was wondering if you could give me a hand on this, I tried it already by myself and somehow I cant get the object to instantiate correctly, first lets say I am making a tower defense game, and I am using both NGUI and HUD TEXT extension. Second point, I have the places where I can spawn the towers so when I click on them I get a NGUI menu to popup and I select the tower and it spawns it.
Now I am facing 2 problems here. First, the menu is a custom panel with 4 buttons, and I deactivate it, so I called it from a script on the towerslot to make it appear, there are several towerslots on the game so I want the panel to appear on top of any when I click on them, I tried using the UIFollowTarget but it doesnt work correctly with all the prefabs of the towerslots.
Second, when I click on the tower I want to instantiate, I get this code to do it but it doesn't instantiate on the towerslot, it does instantiate on the UI object location. Any advice would be great, I was trying to store the towerslot position inside a variable but that doesn't work or I might be doing it wrong.
This is the code for the Tower instantiation...
public GameObject archerTower = null;
// Use this for initialization
void OnClick ()
{
if (Player.gold >= ArcherTowerStats.towerCost)
{
Player.gold -= ArcherTowerStats.towerCost;
Instantiate (archerTower, transform.position, Quaternion.identity);
gameObject.SetActive(false);
}
}