A blinking warning light
Updated
A beacon that flashes its emissive glow on and off twice a second: a Behavior script changing a Standard Material from a timer.
Watch the beacon flash. Drag to orbit the camera, scroll to zoom.
A blinking warning light
#pragma slot(ref=interval, type=Number, min=50, max=5000, default=500)#pragma lifecycle(startup, disable, enable)
let material;let glowing = false;let cancel = null;
function blink() { glowing = !glowing; material.setProps({ emissiveIntensity: glowing ? 4 : 0 }); cancel = delay(blink, interval);}
function startup() { material = self.parent.getComponent(StandardMaterialComponent); material.setProps({ emissive: '#ff3b30' }); blink();}
function disable() { if (cancel) cancel(); material.setProps({ emissiveIntensity: 0 });}
function enable() { blink();}How it works
Section titled “How it works”The script is explained step by step in A blinking warning light.
Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
BlinkingWarningLight.xrproj