Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[unity] DISABLE掉自动注册,手动注册时导致某些类被重复注册报错 #72

Closed
ctxdegithub opened this issue Oct 22, 2020 · 2 comments

Comments

@ctxdegithub
Copy link
Contributor

ExecuteFile("puerts/log.js"); // 执行此语句时会去LoadType(Vector3)

手动调用

AutoStaticCodeRegister.Register

由于Vector3使用了BlittableCopy
当执行

UnityEngine_Vector3_Wrap.InitBlittableCopy(jsEnv);

提示已经注册

报错信息

ArgumentException: An item with the same key has already been added. Key: UnityEngine.Vector3
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <9577ac7a62ef43179789031239ba8798>:0)
Puerts.GeneralGetterManager.RegisterGetter (System.Type type, Puerts.GeneralGetter generalGetter) (at Assets/Kunpo/ThirdParty/Puerts/Src/DataTranslate.cs:280)
Puerts.JsEnv.RegisterGeneralGetSet (System.Type type, Puerts.GeneralGetter getter, Puerts.GeneralSetter setter) (at Assets/Kunpo/ThirdParty/Puerts/Src/JsEnv.cs:227)

AutoStaticCodeRegister生成部分代码
image

@chexiongsheng
Copy link
Collaborator

手动注册这东西本来只是用来做UT测试用的,你为啥要用这东西呢?

@ctxdegithub
Copy link
Contributor Author

原来是个UT用,我是想不同JsEnv注册不同的类

@zombieyang zombieyang changed the title unity DISABLE掉自动注册,手动注册时导致某些类被重复注册报错 [unity] DISABLE掉自动注册,手动注册时导致某些类被重复注册报错 Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants