Closed DrasticLp closed 1 year ago
At what point during the scene's lifecycle are you trying to fetch this data?
Are you doing it from inside the main() function, a function called indirectly by main(), a system or an async block of code? If from any of the above, then this should work, and if not there's surely a bug.
However, if you're not, then it's likely that the corresponding entities are simply not loaded yet. The reason why we have a main function is that it's executed only once the engine has confirmed that everything is already loaded.
I execute it inside a ui The ui is registered inside the main() function I also tried only calling it after 15 seconds to test it and it still crashed
It started to happend when I updated from 7.3.0 to 7.3.7
Another snippet where it's not working:
´´´ts export function Main() { try { canvas = UiCanvasInformation.getOrNull(engine.RootEntity) if(!canvas) { canvas = {'width': 1024, 'height': 768} }
pxWidth = canvas.width
pxHeight = canvas.height
return (canvas)
} catch (e: any) {
utils.timers.setTimeout(() => {
Main()
}, 100)
}
} ´´´ Decentraland Editor SDK7 v1.21.0 in ui.tsx
@DrasticLp can you confirm that with this build the problem is solved?
You can test it starting your local scene and adding &explorer-branch=fix/sdk7-scenes-addition-to-datastore
to the URL
Tackled at https://github.com/decentraland/unity-renderer/pull/5626
The fix will reach production (probably SDK 7.3.11) after the explorer's next release.
Hi, I have some UIs that need to get the screen size in order to work but when I try to get it, it crashes...
Any ideas ?