Hello, what is wrong in this script it give an error in the getAssetById line
var Lake = pc.createScript('lake');
Lake.attributes.add('materialAsset', {type:'asset', assetType:'material'});
Lake.attributes.add('speed', {type:'number', default:0.1});
// initialize code called once per entity
Lake.prototype.initialize = function() {
this.entity.tmp = new pc.Vec2();
if (this.materialAsset) {
this.material = this.app.assets.getAssetById(this.materialAsset).resource;
}
};
// update code called every frame
Lake.prototype.update = function(dt) {
var tmp = this.entity.tmp;
// Calculate how much to offset the texture
// Speed * dt
tmp.set(this.speed, this.speed);
tmp.scale(dt);
// Update the diffuse and normal map offset values
this.material.diffuseMapOffset = this.material.diffuseMapOffset.add(tmp);
//this.material.normalMapOffset.add(tmp);
this.material.update();
};