Create screen entity with an element group and a button.
In the button component, reference the element group entity.
Refresh the scene in editor.
Parts of the UI will fail to render and the error is thrown in the console:
captureconsole.ts:73 TypeError: Cannot read property 'r' of null
at ButtonComponent._storeDefaultColor (playcanvas-stable.js:31863)
at ButtonComponent._storeDefaultVisualState (playcanvas-stable.js:31856)
at ButtonComponent._onImageElementGain (playcanvas-stable.js:31829)
at EntityReference._callGainOrLoseListener (playcanvas-stable.js:31672)
at EntityReference._callAllGainOrLoseListeners (playcanvas-stable.js:31666)
at EntityReference._onAfterEntityChange (playcanvas-stable.js:31648)
at EntityReference._updateEntityReference (playcanvas-stable.js:31638)
at EntityReference.onParentComponentEnable (playcanvas-stable.js:31613)
at ButtonComponent.onEnable (playcanvas-stable.js:32098)
at Entity._onHierarchyStateChanged (playcanvas-stable.js:18214)
at Entity._notifyHierarchyStateChanged (playcanvas-stable.js:18188)
at Entity._onInsertChild (playcanvas-stable.js:10970)
at Entity.addChild (playcanvas-stable.js:10946)
at insertChild (editor.js:107998)
at processEntity (editor.js:108049)
at Array.forEach (<anonymous>)
at createEntities (editor.js:108080)
at Editor.<anonymous> (editor.js:108103)
at Editor.<anonymous> (events.js:37)
at Editor.Events.emit (events.js:57)
at Editor.<anonymous> (editor.js:32657)
at Editor.Events.emit (events.js:57)
at Doc.<anonymous> (editor.js:25644)
at emitNone (editor.js:21377)
at Doc.emit (editor.js:21462)
at Doc.ingestSnapshot (editor.js:24483)
at Doc._handleSubscribe (editor.js:24547)
at Connection.handleMessage (editor.js:23934)
at socket.onmessage (editor.js:23824)
at WebSocket.connection.socket.onmessage (editor.js:25546)
We should give a warning in the button component UI to say that the image reference is not an image type and also be able to handle the error gracefully.
Example scene: https://playcanvas.com/editor/scene/1026142
Create screen entity with an element group and a button. In the button component, reference the element group entity. Refresh the scene in editor.
Parts of the UI will fail to render and the error is thrown in the console: