Hey guys,
So I’m making a game that’ll have multi-platform support over mobile, pc, and xbox. I noticed that the gamepad’s ButtonR2, and mobile’s screen touch both register the mouseButton1Down function. This kinda messes me up because I wanted to have a gui layout for mobile that would allow finger dragging on the right to look around, but drag on the fire button and the gun will start to shoot.
I was wondering if there was a way around this? I was going to use a hacky platform detector:
local InputService = game:GetService("UserInputService")
local Platform = nil
if ( InputService.TouchEnabled == true ) then
local DeviceSize = workspace.CurrentCamera.ViewportSize;
if ( DeviceSize.Y > 600 ) then
Platform = "TABLET"
else
Platform = "PHONE"
end
else
if ( InputService.KeyboardEnabled == false ) then
Platform = "CONSOLE"
else
Platform = "DESKTOP"
end
end
and then I’d just run the mouseButton1Down:connect() if the platform is PC, but I don’t really like how that works, and I think I also might run into errors on mobile when running the game in lower resolutions on computers. Any ideas?
Edit:
Here’s what I’m trying to recreate:
You can hold down the bullet icon to fire, but if you drag it’ll still turn your camera. I don’t think it’s possible to do this with image buttons at the moment, and making it happen would have to be some hacky alternative. At the moment, adding mobile support feels very nasty - but crucial to the development of my game.