Engine Class
StudioDeviceSimulatorService
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
CreateDeviceAsync
Parameters
Returns
Code Samples
Create Device example
local id = Simulator:CreateDeviceAsync({
Name = "My Custom Tablet",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})GetDeviceInfoAsync
Parameters
Returns
GetDeviceListAsync
GetOrientationAsync
Returns
GetScalingModeAsync
RemoveDeviceAsync
SetDeviceAsync
SetOrientationAsync
Parameters
Returns
()
SetPixelDensityAsync
SetResolutionAsync
SetScalingModeAsync
Parameters
Returns
()
StopSimulationAsync
StudioDeviceSimulatorService:StopSimulationAsync():()
Returns
()
UpdateDeviceAsync
Parameters
Returns
()
Code Samples
Update Device example
Simulator:UpdateDeviceAsync(id, {
Name = "My Custom Tablet",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Events
ConfigurationChanged
Code Samples
Configuration changed example
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)