I have an animation that does work and i’m trying to play it through a script. No error is given, but it doesn’t play.
var Playhitanim = pc.createScript('playhitanim');
Playhitanim.attributes.add('Animation', {
type: 'asset'
});
// initialize code called once per entity
Playhitanim.prototype.initialize = function() {
};
// update code called every frame
Playhitanim.prototype.update = function(dt) {
this.app.keyboard.on(pc.EVENT_KEYDOWN, this.keyDown, this);
this.entity.animation.play('untitled.json');
};
// swap method called for script hot-reloading
// inherit your script state here
// Playhitanim.prototype.swap = function(old) { };
// to learn more about script anatomy, please read:
// http://developer.playcanvas.com/en/user-manual/scripting/
Project: https://playcanvas.com/project/634746/overview/new-game-1