エンジンクラス
GamepadService
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
方法
DisableGamepadCursor():() |
EnableGamepadCursor(guiObject: Instance):() |
APIリファレンス
プロパティ
GamepadCursorEnabled
コードサンプル
GamepadService - ゲームパッドカーソル有効プロパティ
local gamepadService = game.GamepadService
gamepadService:GetPropertyChangedSignal("GamepadCursorEnabled"):Connect(function()
local enabled = gamepadService.GamepadCursorEnabled
if enabled then
-- バーチャルカーソルが有効なときのカスタムコード
else
-- バーチャルカーソルが無効なときのカスタムコード
end
end)方法
DisableGamepadCursor
GamepadService:DisableGamepadCursor():()
戻り値
()
コードサンプル
ゲームパッドサービス - ゲームパッドカーソルを無効にする
local gamepadService = game.GamepadService
local userInputService = game.UserInputService
userInputService.InputBegan:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.ButtonB then
gamepadService:DisableGamepadCursor()
end
end)EnableGamepadCursor
パラメータ
戻り値
()
コードサンプル
ゲームパッドサービス - ゲームパッドカーソルを有効にする
local gamepadService = game.GamepadService
local userInputService = game.UserInputService
local startObject = script.Parent
userInputService.InputBegan:Connect(function(inputObject, gameProcessed)
-- ボタンAが押された場合にゲームパッドカーソルを有効にする
if inputObject.KeyCode == Enum.KeyCode.ButtonA then
gamepadService:EnableGamepadCursor(startObject)
end
end)