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

调用引擎 API 和项目脚本 #979

Closed
tidys opened this issue Aug 13, 2019 · 0 comments · Fixed by #986
Closed

调用引擎 API 和项目脚本 #979

tidys opened this issue Aug 13, 2019 · 0 comments · Fixed by #986
Assignees

Comments

@tidys
Copy link
Contributor

tidys commented Aug 13, 2019

URL : https://github.com/cocos-creator/creator-docs/blob/master/zh/extension/scene-script.md

## 注册场景脚本

首先在 `package.json` 里添加 `scene-script` 字段,该字段的值是一个脚本文件的路径,相对于扩展包目录:

```json
    "name": "foobar",
    "scene-script": "scene-walker.js"

该路径将指向 packages/foobar/scene-walker.js,接下来我们看看如何编写场景脚本。


关于此处的说明,有开发者反馈说的不是太明白,这个误解主要是name:'foobar'造成的,开发者理解成了packages.json应该这样书写

{
  "name":"my-plugin",
  "scene-script":{
      "name":"foobar",// 开发者以为这个是scene-script的别名
      ""scene-script:"scene-walk.js"
  }
}

是否考虑文档中这样写
示例packaage.json如下:

{
   "name": "foobar",
    "scene-script": "scene-walker.js"
}

另外foobar,是否考虑换成my-plugin-name,这样更容易理解

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

Successfully merging a pull request may close this issue.

2 participants