this.sendCodeBlockEvent() can only be called from within a Component,
not a normal function. "this" is a keyword that is a reference to the
object that is currently block-scoped. Instead of "this: any" in your
parameters, use "entity: Entity" and cal...
Create a prop of PropType.Entity within your UI component, then place
the text gizmo into that prop. Within the UI component, you can cast the
entity as a text gizmo using .as(TextGizmo), and then use .text.set() to
pass in the new text string.
This has been occasionally happening to me, too. Sometimes restarting
helps but the issue returns intermittently. When it happens again, it'll
be good for us to use the in-editor bug reporting tool to get it in
front of Meta.
The error indicates that you are missing the script you're trying to
import. It appears you've gotten this code from the documentation and
are missing the NPCAgent.ts file. You can grab the code here:
https://developers.meta.com/horizon-worlds/learn/...