Uncaught TypeError: this.app.findByName is not a function

Hello, I’m a bit new to Playcanvas and I have a problem with my game. So basically, I want a dialogue to pop up via the 2D Screen when my character collides with a certain object: For example: I want a dialogue to pop up when my character hits the object intwalis (indicated both in the scene and the script). But when I applied this code:

CollisionStart.prototype.initialize = function() {


var Dialogue = this.app.root.findByName("dialogue");

Dialogue.element.text = String();

//function for onCollision start

CollisionStart.prototype.onCollisionStart = function(result){

 if(result.other.name == 'intwalis'){

  var Dialogue = this.app.findByName("dialogue");

  Dialogue.element.text = String ("Oohh~ Walis Tambo! Are you going to sweep? Interact with the object to do so!");

It says an error “Uncaught TypeError: this.app.findByName is not a function”

Here is a screencap to the script used.

Here is also a link to the game. I hope I can get some help. Thank you.

Hi @Ramm and welcome,

You need to target the root entity to use findByName like that, update that line to:

var Dialogue = this.app.root.findByName('dialogue');
1 Like


All I needed was a period to fix the issue and it worked!

Thanks a lot!

1 Like