我尝试通过脚本调用动态语音,但是会引发未定义的异常
sumerian-custom-scripts/b001a0912e4b4f339ce5252ed1c46659.script.js?v=2:29 Uncaught TypeError: Cannot read property 'playSpeech' of undefined
at sumerian-custom-scripts/b001a0912e4b4f339ce5252ed1c46659.script.js?v=2:29
at emitToListeners (Bus.js:240)
at traverse (Bus.js:255)
at emitToAll (Bus.js:259)
at Bus._emitToSingle (Bus.js:79)
at Bus.emit (Bus.js:41)
at Object.<anonymous> (sumerian-custom-scripts/570aefb4145a45529aad8a9232f9b170.script.js?v=7:62)
代码已尝试-
var setup = function(args, ctx) {
sumerian.SystemBus.addListener('aws.sdkReady',
() => {
var speechComponent = ctx.entity.getComponent("speechComponent");
var speeches = speechComponent.speeches;
var speech = speeches[Math.floor(Math.random() * speeches.length)];
speech.play();
},
true
);
};