[BUG] entity property from component became string instead of entity object

I was trying to use “this.entity.scrollview.contentEntity.children.length” are got exception

Uncaught TypeError: Cannot read properties of undefined (reading ‘length’)

and after i print out the log , the contentEntity became string “d9d92348-142f-4cc4-b52f-fd9e719f7e76” and children became “undefined”

any advise ?


var content = this.entity.scrollview.contentEntity;
    if( typeof(content) == 'string'){
        console.log(`find by guid: ${content}`);
        content = this.app.root.findByGuid(content);

i found this hack fix is work for now

Unfortunately it’s a known issue: scrollview#contentEntity returns the Entity id, not a pc.Entity · Issue #2536 · playcanvas/engine · GitHub

Your workaround is the best we have so far.