Studio Device Simulator Service
Summary
Methods
CreateDeviceAsync(config: Dictionary):string |
GetDeviceInfoAsync(deviceId: string):Dictionary |
RemoveDeviceAsync(deviceId: string):() |
SetDeviceAsync(deviceId: string):() |
SetOrientationAsync(orientation: Enum.ScreenOrientation):() |
SetPixelDensityAsync(density: number):() |
SetResolutionAsync(width: number,height: number):() |
StopSimulationAsync():() |
UpdateDeviceAsync(deviceId: string,config: Dictionary):() |
Events
API Reference
Methods
Create Device Async
Parameters
Returns
Code Samples
Create Device example
local Simulator = game:GetService("StudioDeviceSimulatorService")
local id = Simulator:CreateDeviceAsync({
Name = "My Custom Tablet",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})
print(id)Get Device Info Async
Parameters
Returns
Get Device List Async
Get Orientation Async
Returns
Get Scaling Mode Async
Remove Device Async
Set Device Async
Set Orientation Async
Parameters
Returns
()
Set Pixel Density Async
Set Resolution Async
Set Scaling Mode Async
Parameters
Returns
()
Stop Simulation Async
Studio Device Simulator Service: Stop Simulation Async():()
Returns
()
Update Device Async
Parameters
Returns
()
Code Samples
Update Device example
local Simulator = game:GetService("StudioDeviceSimulatorService")
local id = "CUSTOM_DEVICE_ID" -- The id returned by CreateDeviceAsync
Simulator:UpdateDeviceAsync(id, {
Name = "My Custom Tablet",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Events
Configuration Changed
Code Samples
Configuration changed example
local Simulator = game:GetService("StudioDeviceSimulatorService")
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "default" then
local res = Simulator:GetResolutionAsync()
print(string.format("Active: %s @ %dx%d", deviceId, res.X, res.Y))
end
end)