LENS STUDIO SNIPPET
// @input asset.TextAsset levelData
script.createEvent("OnAwakeEvent")
.bind(function(){
var d = JSON.parse(script.levelData.text);
// d.width / d.height are the EDITOR's pixel canvas — calibrate
// pixelToWorld() below to your scene's actual units/orientation.
function pixelToWorld(x, y) {
return {
x: (x - d.width / 2) / 100, // adjust divisor to your scene scale
y: -(y - d.height / 2) / 100, // editor is y-down, Lens Studio is often y-up
};
}
d.objects.forEach(function(o){
var pos = pixelToWorld(o.x + o.w / 2, o.y + o.h / 2);
// o.type: 'spawn' | 'goal' | 'obstacle' | 'platform' | 'coin' | 'hazard' | 'enemy'
// spawn your prefab for o.type at pos, sized from o.w / o.h
});
});