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]鸿蒙出包注意事项 #1717

Closed
chexiongsheng opened this issue May 10, 2024 · 0 comments
Closed

[Unity]鸿蒙出包注意事项 #1717

chexiongsheng opened this issue May 10, 2024 · 0 comments

Comments

@chexiongsheng
Copy link
Collaborator

chexiongsheng commented May 10, 2024

v8以及quickjs的冒烟测试已经通过,测试代码如下:

using UnityEngine;

namespace PuertsTest
{
    public class JsCallCs : MonoBehaviour
    {

        void Start()
        {
            Debug.Log(">>>>>>>>>>>>>>>> hello world;");

            var jsEnv = new Puerts.JsEnv();

            jsEnv.Eval(@"
                let gameObject = new CS.UnityEngine.GameObject('testObject');
                CS.UnityEngine.Debug.Log(gameObject.name);
                throw new Error('aaaaa');
            ");
            jsEnv.Dispose();
        }


        void OnDestroy()
        {
        }
    }
}

1、Plugins下目录名为OpenHarmony,并且so设置好平台和架构(目录结构和设置的meta信息已经提交到github)
2、发该issue前,puerts尚未出含鸿蒙库的正式release,可以fork一份puerts的仓库,在github上的actions/unity publish那点击“Run workflow”自行构建;
3、Asserts目录下的.d.ts文件需删除,比如这个:https://github.com/Tencent/puerts/blob/master/unity/Assets/core/upm/Typing/puerts/index.d.ts ,否则可能导致出包报错

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

1 participant