我对编程很陌生,我正在尝试使用脚本来修补桥接技术。我不知道为什么这不起作用,这是我的代码:
const Scene = require('Scene');
const Patches = require('Patches');
export const Diagnostics = require('Diagnostics');
const patchValue = Patches.getScalarValue('GameScore');
Promise.all([
Scene.root.findFirst("sampletxt"),
]).then(function(results){
var ScoreText = results[0];
ScoreText.text = patchValue.toString();
});
Diagnostics.watch('runtime -', patchValue); // im using this line to see if the script reads the value from patch.
这是来自控制台日志的错误:
改用PatchesModule.outputs.getScalar
!@爱马仕运行时
此 API 已弃用,请升级到最新的 SDK 版本。信息:
@
HermesRuntime
Possible Unhandled Promise Rejection: Unexpeted SceneObject reference: {"identifier":"2_d_text_model:7030-1be1a0e4-3bb6-4a3b-bc9c-e17b7b57aa6c","name":"sampletxt","materialIdentifier":"","className":"planarText","modelId":505}
请帮助我,谢谢