收藏
回答

unit 导出微信小游戏后,一直加载失败,报错如下initRandomDevice,不知道如何解决?

e.printErr	@	plugin.js:93
	abort	@	webgl.wasm.framework.unityweb.js? [sm]:9
	(anonymous)	@	webgl.wasm.framework.unityweb.js? [sm]:9
	randomFill	@	webgl.wasm.framework.unityweb.js? [sm]:9
	randomByte	@	webgl.wasm.framework.unityweb.js? [sm]:9
	read	@	webgl.wasm.framework.unityweb.js? [sm]:9
	read	@	webgl.wasm.framework.unityweb.js? [sm]:9
	(anonymous)	@	webgl.wasm.framework…nityweb.js? [sm]:26
	Ef	@	webgl.wasm.framework…nityweb.js? [sm]:26
	read	@	09973e5e:0x201869
	SystemNative_GetNonCryptographicallySecureRandomBytes	@	09973e5e:0x959fa
	InputAction__ctor_m2C9BD26403717DAA628B90D4CD2A4057233A1A44	@	09973e5e:0x79fcb5
	RuntimeInvoker_TrueVoid_t4861ACF8F4594C3437BB48B6E56783494B843915(void (*)(), MethodInfo const*, void*, void**, void*)	@	09973e5e:0x1614716
	il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**)	@	09973e5e:0x11bfc6d
	dynCall_iiii	@	09973e5e:0x1208150
	g	@	webgl.wasm.framework…nityweb.js? [sm]:26
	il2cpp_runtime_object_init_exception	@	09973e5e:0x5f031f
	Scripting::RuntimeObjectInitLogException(ScriptingObjectPtr, ScriptingCtorCache*)	@	09973e5e:0x95c9a
	void Transfer_ManagedObject(SerializationCommandArguments const&, RuntimeSerializationCommandInfo&)	@	09973e5e:0x106c6d8
	void TransferField_LinearCollection(SerializationCommandArguments const&, RuntimeSerializationCommandInfo&)	@	09973e5e:0x8ab6e8
	void Transfer_ManagedObject(SerializationCommandArguments const&, RuntimeSerializationCommandInfo&)	@	09973e5e:0x106c784
	void TransferField_LinearCollection(SerializationCommandArguments const&, RuntimeSerializationCommandInfo&)	@	09973e5e:0x8ab6e8
	void TransferScriptingObject(StreamedBinaryRead&, ScriptingObjectPtr, ScriptingClassPtr, SerializationCache::Data*&)	@	09973e5e:0x8a8efd
	SerializableManagedRefTransfer::Transfer(Object*, SerializableManagedRef&, StreamedBinaryRead&, bool)	@	09973e5e:0xc4a190
	MonoBehaviour::VirtualRedirectTransfer(StreamedBinaryRead&)	@	09973e5e:0x17b0dde
	SerializedFile::ReadObject(long long, ObjectCreationMode, bool, TypeTree const**, bool*, Object&)	@	09973e5e:0xc44de5
	PersistentManager::ReadAndActivateObjectThreaded(int, SerializedObjectIdentifier const&, SerializedFile*, bool, bool, PersistentManager::LockFlags)	@	09973e5e:0x4a5af2
	PersistentManager::LoadFileCompletelyThreaded(core::basic_string_ref, long long*, int*, int, PersistentManager::LoadFlags, LoadProgress&, PersistentManager::LockFlags)	@	09973e5e:0x4a66a3
	RunWebGLPlayer()	@	09973e5e:0xc7fe7b
	main	@	09973e5e:0x11b6ddd
	Promise.then (async)		
	instantiateArrayBuffer	@	webgl.wasm.framework.unityweb.js? [sm]:9
	(anonymous)	@	webgl.wasm.framework.unityweb.js? [sm]:9
	unityFramework	@	webgl.wasm.framework.unityweb.js? [sm]:9
	(anonymous)	@	plugin.js:93
	Promise.then (async)		
	t.invokeLoadWasmCode	@	plugin.js:93
	t	@	plugin.js:93
	(anonymous)	@	plugin.js:93
	c	@	plugin.js:93
	value	@	plugin.js:93
	(anonymous)	@	plugin.js:93
	s	@	plugin.js:68
	(anonymous)	@	plugin.js:68
	(anonymous)	@	plugin.js:68
	o	@	plugin.js:93
	Promise.then (async)		
	u	@	plugin.js:93
	(anonymous)	@	plugin.js:93
	Ir	@	plugin.js:93
	(anonymous)	@	plugin.js:93
	Promise.then (async)		
	(anonymous)	@	plugin.js:93
	s	@	plugin.js:68
	(anonymous)	@	plugin.js:68
	(anonymous)	@	plugin.js:68
	(anonymous)	@	plugin.js:93
	Ir	@	plugin.js:93
	value	@	plugin.js:93
	(anonymous)	@	game.js? [sm]:180
	Promise.then (async)		
	(anonymous)

最后一次编辑于  01-10
回答关注问题邀请回答
收藏

2 个回答

  • Elvis
    Elvis
    01-14
    var randomByte = () => {
                if (Module.IsWxGame) {
                  return Math.random() * 256 | 0
                };
    

    请在webgl.wasm.framework.unityweb.js代码里修改上述代码

    01-14
    有用 1
    回复
  • 智能回答 智能回答 该问答由AI生成
    01-09
    有用
登录 后发表内容