I am building a game in which there are two ui buttons on the game. I am using unity 4.6 to build this.I have one button that will turn my player blue and another that will turn the player yellow. I need it so when both are pressed my player will turn green. I haven't found much on multitouch with these UI buttons. I would love the help!
In the usual button paradigm, the button completes the action when the user presses the button and then ends the press while the pointer (mouse or finger) still on the button. This is called "click". You are saying that you need this event to happen while the buttons are still pressed — so, you want them to react to press-down event, not the click event. Therefore, they are no longer classical buttons, and you probably shouldn't use Unity's UI Button for this functionality. If you'd use buttons for that, when the user first pressed on both buttons, you'd get green color, but when he then stopped touching them, you'd finally get yellow or blue player.
Instead, use the EventTrigger component on each individual "pseudo-button" to register press-down events, and a separate custom component that would implement your logic. Essentially, the only way to realize your requirements without them being contradictory, is to assign the yellow color when the player is pressing down both "pseudo-buttons" and assign other colors when the player lifts his fingers up from either of them — but given that this particular touch wasn't used to trigger the yellow color.
Related
I am working on a screen of a game, and I want this behaviour: when you swipe in any place of the screen (even over a button) you can scroll, but at the same time you can click in any button.
Now I have a big empty image occupying the whole screen that can capture the drag events, but since raycast is ON, click events are not passing down to the elements below in the hierarchy. So buttons are not working.
Which is the proper way of achieving this?
I have created button animations but i want it to show just the normal, pressed and disabled animation clips. Do You Have any idea how we can achieve this.
When The Cursor Goes over it should keep playing the "normal animation clip".
Make sure that your Button Settings look similar to this example and that you have created all the needed animations for your button with the correct names.
In this example the Button plays the Normal animation when the player highlights as well. You could also add the Normal animation to the Selected Trigger or just let it empty (or don't create the animation with that specific name)
If you just wan't to keep playing the Normal Animation let Highlighted and Selected empty
I am working on a project in unity5, while I am making a menu contain buttons, I need button to make glowing outline, need help in this regard.enter image description here
same in the picture, I need button like this in my Unity 5
if you are using canvas you can do that without using any functions or events it can be easily done select button in inspector you will see button (script) component set transition to sprite swap and drop the desired sprite in pressed sprite box.
There is a simple button in our application which when is pressed works just as expected, but with a light quick touch it just greys out and does nothing.
Is there a way to capture those light touches too?
EDIT:
I see now when exactly it doesn't work and it is when I tap, drag and release. (even if I tap, drag and don't leave the button area)
Try setting EventSystem.pixelDragThreshold to a higher value. This threshold makes the difference between a click and a drag, and it's default value is quite low for high-res touch systems.
What I want to do, is whenever the user clicks anywhere on the screen, a shadow or an instance of a shadow is created wherever they click for as long as they click. Like having an app that has a white background but whenever you press the screen a black dot appears under your finger and follows it but when you take your finger off it disappears.
To handle touch events, here's a great guide on UIGestureRecognizers on Raywenderlich.
As for the black dot that you described, you could try drawing it with CoreGraphics.