- Home /
Android unity, have the left side of the screen act as Fire1 and the right side act as Fire2.
Hello, I am attempting to set up my phone to have the left half activate a force script on the left flipper and the right side activate the script for the right flipper. In essence I am wanting the left side to act as Fire1 and the right side act as Fire2 when ever they are touched. Right now, one finger touching the screen is acting as Fire1 and when I use two fingers it acts as Fire2. I have attempted to use UI buttons, but I cannot get them to work properly. Any help is greatly appreciated.
Answer by Landern · Apr 27, 2017 at 02:59 PM
All you need to do is use the touch.deltaposition which is a vector2 and check the X is greater then divide the screen width in half and check to see if it's greater than that. If is less than that then it's left if it's greater then it's right.
Answer by RocketMan0896 · Apr 28, 2017 at 05:59 AM
Thank you for replying! I was able to find a tutorial that suggested this as well and used ray casting attached to the camera that determines the position of a touch. Thanks again.
Answer by cafat · Apr 28, 2017 at 06:01 AM
You can do something like on this tutorial https://youtu.be/4JWh9Zfz3PM