[SOLVED] Why my codes let text show?

I want some texts show when the player collide with a cylinder,but my code dosen’t work.

var Success = pc.createScript('success');

Success.attributes.add('UI', {
    type: 'entity',
    title: 'Target UI',
    description: 'The target UI which will show after success.'
});

// initialize code called once per entity
Success.prototype.initialize = function() {
    this.entity.collision.on('triggerenter', this.onTriggerEnter, this);
};

Success.prototype.onTriggerEnter = function() {    
    this.UI.enabled = true ;
    
};

My project: Overview | Dashboard | MazeGame | PlayCanvas | 3D HTML5 & WebGL Game Engine

Hi @JINGJING!

Please make sure your trigger entity has no rigidbody component, otherwise it will not act as a trigger.

It doesn’t have rigidbody component.

Alright, is the script attached to the trigger entity and does your player entity has a rigidbody component and a collision component?

I checked, those things are alright.

I checked your project and I see your trigger entity has a rigidbody component. Even when this component is disabled it will not act as a trigger.

Thanks!Now it works.