I get this error when it was just working fine until I messed up the script, I rewrote it and can’t get rid of the error from popping up. If I take it out the code won’t work and when I press launch it works fine just has the error now. I’m doing this for a game design class at my school so time is of the essence and it is attached to the enemy if anyone thought it wasn’t attached to anything. the code for the script is:
var Trigger = pc.createScript('trigger');
// initialize code called once per entity
Trigger.prototype.initialize = function() {
this.entity.collision.on('triggerenter', this.onTriggerEnter, this);
};
// update code called every frame
Trigger.prototype.update = function(dt) {
if (this.app.timeScale == 1) {
this.entity.translate(0, 0, -0.1);
}};
Trigger.prototype.onTriggerEnter = function (result) {
this.entity.enabled = 0;
result.enabled = 0;
};
Please let me know if there is something wrong with my script or what you think could work to fix my game. I’ve been trying to read how to fix it through multiple forums and I tried copying and replacing the script I had before but still the same error. It worked before so I don’t know what the problem is now. I am in the optimization progress of my game if that helps.