Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: will_brett on March 16, 2013, 05:20:37 PM
-
Hello everyone.
I will try and write this question clearly but if it isn't please feel free to ask questions. I am using NGUI
What I have is a little popup menu that I have made from a sprite. Inside this sprite (which is essentially a background image for a menu) I have 6 different buttons. However when the menu sprite is not active the buttons are still visible. How do I go about having these buttons only show when the menu is shown? I don't want to simply deactivate the buttons as there functions require them to be active.
To understand better...
What I am trying to do is a have a button that open up a menu that allows a player to send items to another player.
Then there is a second button that allows you to see the items that you have been sent.
Hope there is enough information here and that I have written the question clearly.
Looking forward to hearing your responses
All the best
WB
-
I don't quite understand.
You say:
How do I go about having these buttons only show when the menu is shown?
You want them to show only then, when the actual menu is shown.
But then you say:
I don't want to simply deactivate the buttons as there functions require them to be active.
I don't get this. If the buttons are not shown, how can the Player access those functions?
If i get this right, you have this scenario:
- One Button, when it is clicked/tapped, the Menu shows up
-> that Menu has its own 6 buttons
If i am right, i don't see a problem (de)activating the Buttons.
-
Thanks for reply.
The issue is that these buttons are activated by another player.
Perhaps it would make more sense if i say that the buttons represent items that another player has sent. I dont want these items to just appear on the screen... i want them to appear inside the menu to keep everything tidy. The other player may send these items when the menu isn't open.
hope this makes more sense
-
Ah, now i understand.
So, when you press the First Button you get the Menu with the Items (aka Buttons), which another Player sent.
Can't you just make these Items/Buttons invisible. They stay active, but as soon the Menu pops out, you make them visible again.
-
how is this done? I didn't even realise this was an option
Cheers
Will
-
Im using NGUI btw and im not sure you can just set the renderer.enabled = false like you can with objects
-
You can access it via "Set Property".
There you drag and drop the NGUI-Component (the UISprite component), and be sure that you dragged and dropped that certain Component into the "Target Field" of the "Set Property"-Action. Here is a screen:
(http://www.kingpic.net/uploads/bildschirmfoto_2013-03-17_um_01_20_24.png)
(In this case the "Background" is the GameObject, but you have to drag the "UISliced Sprite"-Component in the Target-Field!)
Just uncheck the "enabled"-Property and there you go.
I do not know if this is really the best approach within NGUI, i use it and for now it works fine for me.
-
Brilliant I will try that today.
Thank you
-
Just gave this a go. It sort of works but it actually just does the same thing as activate game object.
The issue is that I want the button/sprite to only be seen when the menu is open (this bit works fine) but in the menu I want it to be hidden unless the other player has sent it.
What Im getting at the moment is that the button is there regardless of wether or not the other player has sent the item.
cheers
-
Ok so what I am currently working on is an FSM that checks to see if the menu is open or not. If it is and the other player has sent the item then it will appear. My only issue now is that if the other player sends an item and the receiving player clicks the menu the item appears but if they close the menu without clicking the tem the item disappears.
Im sure I will be able to fix this soon
Thanks for all your help.