Detecting Gamepads

Detecting Gamepads



local UserInputService = game:GetService("UserInputService")


if UserInputService.GamepadEnabled then

    print("Player has gamepad enabled...")

end



local UserInputService = game:GetService("UserInputService")


UserInputService.GamepadConnected:Connect(function(gamepad)

print("Player has connected controller: " .. tostring(gamepad))

end)


UserInputService.GamepadDisconnected:Connect(function(gamepad)

print("Player has disconnected controller: " .. tostring(gamepad))

end)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • General New Features Xcode 11 beta supports development w...
    Zszen阅读 3,540评论 0 50
  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,499评论 0 10
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,273评论 19 139
  • Getting Started Use the Current Stable Version (7.1) Buil...
    Leonzai阅读 1,994评论 0 3
  • IOS App 审核指南 原文地址: https://developer.apple.com/app-store/...
    袁俊亮技术博客阅读 3,184评论 1 1