Hi,
I'm currently working on a context menu that appears if the player presses a button for a certain amount of time. After the player releases the button the Menu disappears.
It's already working that it shows on click and disappears on release of the mouse button.
However the effects like coloring, resizing and so on don't work.
This is my OnPress function:
void OnPress(bool pressed) {
if (pressed) {
if (UICamera.currentTouchID == (int)menuButton) {
RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, Mathf.Infinity)) {
ShipComponent hitComponenent = hit.transform.GetComponent<ShipComponent>();
if (hitComponenent) {
if (hitComponenent == _selectShipComponent.selectedComponent) {
EnableCountdownForMenu();
_menuPos = Input.mousePosition;
}
}
}
}
} else {
DisableCountdownForMenu();
DestroyMenu();
}
}
And this code is responsible for showing the menu:
NGUITools.SetActive(menu, true);
menu.transform.localPosition = _menuPos;
I hide the menu with
NGUITools.SetActive(menu, false);
If I disable the hiding the button works as expected (scaling and coloring...)
The Menu is a simple gameobject with some buttons and a sprite as children
Any idea what I do wrong?