ReadonlyonTriggered when battery state changes.
deviceInfoSystem.onBatteryStateChanged.add((batteryState) => {
print(
"Battery state changed. New battery level: " +
batteryState.batteryLevel +
"%, isCharging: " +
batteryState.isCharging
);
});
@component
export class NewScript extends BaseScriptComponent {
onAwake() {
deviceInfoSystem.onBatteryStateChanged.add((batteryState) => {
print(
"Battery state changed. New battery level: " +
batteryState.batteryLevel +
"%, isCharging: " +
batteryState.isCharging
);
});
}
}
ReadonlyonTriggered when internet availability changed.
// @input Component.Text textObject
global.deviceInfoSystem.onInternetStatusChanged.add(function(eventData) {
script.textObject.text = eventData.isInternetAvailable
? "UPDATED: Internet is available"
: "UPDATED: No internet";
});
@component
export class NewScript extends BaseScriptComponent {
@input textObject: Text;
onAwake() {
this.textObject.text = global.deviceInfoSystem.isInternetAvailable()
? "Internet is available"
: "No internet";
global.deviceInfoSystem.onInternetStatusChanged.add((args) => {
this.textObject.text = args.isInternetAvailable
? "UPDATED: Internet is available"
: "UPDATED: No internet";
});
}
}
ReadonlyperformanceReturns the PerformanceIndexes object, which provides performance information about the device.
ReadonlyscreenSpecifies the device pixel ratio. Can be used to set rendering at the real screen resolution.
Returns the current battery state of the device.
var deviceInfoSystem = global.deviceInfoSystem;
if (!deviceInfoSystem.isEditor()) {
var batteryState = deviceInfoSystem.getBatteryState();
print(
"Current battery level: " +
batteryState.batteryLevel +
"%, isCharging: " +
batteryState.isCharging
);
}
@component
export class NewScript extends BaseScriptComponent {
onAwake() {
const deviceInfoSystem = global.deviceInfoSystem;
if (!deviceInfoSystem.isEditor()) {
const batteryState = deviceInfoSystem.getBatteryState();
print(
"Current battery level: " +
batteryState.batteryLevel +
"%, isCharging: " +
batteryState.isCharging
);
}
}
}
StaticgetGet the DeviceCamera object for the given camera ID which provides intrinsics/extrinsics of the camera.
Returns the name of this object's type.
Returns true if the device has access to the internet.
// @input Component.Text textObject
script.textObject.text = global.deviceInfoSystem.isInternetAvailable()
? "Internet is available"
: "No internet";
@component
export class NewScript extends BaseScriptComponent {
@input textObject: Text;
onAwake() {
this.textObject.text = global.deviceInfoSystem.isInternetAvailable()
? "Internet is available"
: "No internet";
}
}
Returns true if the object matches or derives from the passed in type.
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Provides information about the device running the Lens. Accessible through
global.deviceInfoSystem.Example