The navigation images for up, down, left and right that you need to use with Android and iPad, don’t always work right. I think it is because there is no code for “on release” command.
When playing on Windows, these buttons are hidden because the player uses the mouse and keyboard.
Have you considered using multi touch for what you are doing, instead of the mouse emulation with touch (which is effectively what the “Mouse or left button is down” is)? I understand it’ll require a bit of refactoring of your events, but it may work better for you and help with the issues.
That looks great, now I just have to wrap my head around changing my code, not quite sure how. I am going to do some reading on “A new touch has started”, I never used it before.
I’d suggest making a small new project, pottering round with it for a few hours to get to grips with multitouch, and then applying what you’ve learnt to your project.
And I just remembered, the multitouch commands may have changed since the example was written. If some of the function names no longer exist, raise it on the forum - there will be someone who can help with the correct function name.
Do you mean to only work with one touch at a time? Keep track of the first touch that is made. Something like this will only keep the player moving with the first touch made on screen if there are no current touches:
I thought the “Touch or Left mouse button is down” and “The cursor/touch is on (object)” only works with single touch. It works all the time in Windows, but not always on iPad or Android. So the code above will work with all three platforms?
I am going to try your examples out and get back to you. Thanks.
Well, the arrow buttons move alot slower and it still animates/deletes object that is under the target/cursor when pressing the arrow keys. (on Android/iPad). Before I could hold down the arrows (when they decided to work) and the camera would zoom around, see code above. Now I have to tap, tap, tap all the way thru the game. That happened when I added Trigger Once to the code above.
Does the “A new touch has started” replace “Touch or Left mouse button is down”, Trigger Once above the Cast a ray code? No longer need to specify Left mouse button is down?
I updated the code from above. Now it doesn’t touch the target when I touch the arrow buttons.
No, it just identifies the first time a touch has been made. Each new touch will trigger the “A new touch has started” condition.
Not quite, you need to approach it a little differently. As it stands, you only rotate the camera when a new touch is started. Instead it needs to occur while istouching it true. What you need is something along lines of the following events:
Tried this, works in Windows but not on ipad or android. It doesn’t have to work in windows, because the code is for a mobile device. Just thinking out loud!
Make every button multitouch joystick button (not analog)
And now you use only mouse or cursor is on that button condition
And works both on desktop and mobile
Sliders work the same way and you can check it by adding a slider while using above action
And you will be able to drag it only on desktop by holding LMB and moving it
On mobile by touch and drag
Or test it here before you do anything
I did not care for clicks on desktop so i left it just as cursor or touch is on object
And so everything work on just hovering over it
HOWEVER
Go to settings (icon in upper right corner)
And you will need to click on slider and then you will be able to drag it
Or click on some part of slider to move knob there
It won’t work just on hover
While on mobile it will work with touches
And sorry it is not cursor or touch is on button
But you use button is pressed condition
You shouldn’t need to use raycast to detect the touch position on an object on a 2D layer.
Like I wrote earlier, make a new, small project just for the multitouch and get that working. Use the preview over network and a browser on the device for it - you can then make changes on the fly and update the preview without having to stop and start it (unless you don’t mind compiling and reloading the apk on every change)
I needed to test my solution and
Tell me can you click it same way on desktop as you can on mobile
Cause for me on windows i need to hover cursor over it and press LMB
On android i need to touch it
Sliding over it do not work (as expected since we do not want that)
And all i did was use that action to not move cursor with touch
Like one single condition
Only Difficulty text have it
But like i said for me it works perfectly as clickable object on both devices
Hovering over it do not work which is the something i did want
Where start game do not have it and on desktop simply hovering cursor over it will start game
So i say it would be pretty much easier solution to implement
And i don’t need to check if my device is mobile or not