Skip to content

Commit ec1a574

Browse files
xunyi0slackmoehrle
andauthored
完善部分文档 (cocos#1842)
* 完善部分文档 * Commit changes * 完善并更新对齐策略 * Commit changes * Apply suggestions from code review Co-authored-by: Slack-Moehrle <[email protected]> Co-authored-by: Slack-Moehrle <[email protected]>
1 parent 1baff83 commit ec1a574

File tree

100 files changed

+331
-516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+331
-516
lines changed

en/SUMMARY.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,11 @@
9898
- [Publish to HUAWEI AppGallery Connect](editor/publish/publish-huawei-agc.md)
9999
- [Publish to Alipay Mini Games](editor/publish/publish-alipay-mini-game.md)
100100
- [Publish to ByteDance Mini Games](editor/publish/publish-bytedance-mini-game.md)
101-
- [Publish to QTT Mini Games](editor/publish/publish-qtt.md)
102101
- [Publish to Cocos Play](editor/publish/publish-cocos-play.md)
103102
- [Publish to Huawei Quick Games](editor/publish/publish-huawei-quick-game.md)
104103
- [Publish to OPPO Mini Games](editor/publish/publish-oppo-mini-game.md)
105104
- [Publish to vivo Mini Games](editor/publish/publish-vivo-mini-game.md)
106105
- [Publish to Xiaomi Quick Games](editor/publish/publish-xiaomi-quick-game.md)
107-
- [Publish to LinkSure Mini Games](editor/publish/publish-link-sure.md)
108106
- [Publish to Baidu Mini Games](editor/publish/publish-baidu-mini-game.md)
109107
- [Publish to WeChat Mini Games](editor/publish/publish-wechatgame.md)
110108
- [WeChat Engine Plugin](editor/publish/wechatgame-plugin.md)
@@ -114,7 +112,6 @@
114112
- [Publish from the Command Line](editor/publish/publish-in-command-line.md)
115113
- [Build Process with FAQ](editor/publish/build-guide.md)
116114
- [Custom Project Build Process](editor/publish/custom-project-build-template.md)
117-
- [Extend the Build Process](editor/publish/custom-build-plugin.md)
118115

119116
## Function Modules
120117

@@ -278,8 +275,8 @@
278275
- [First Extension](editor/extension/first.md)
279276
- [First Panel](editor/extension/first-panel.md)
280277
- [First Data Interaction](editor/extension/first-communication.md)
281-
- [Install And Share](editor/extension/install.md)
282-
- [Extension Description](editor/extension/define.md)
278+
- [Install and Share](editor/extension/install.md)
279+
- [Submitting Resources to Cocos Store](editor/extension/store/upload-store.md)
283280
- [Extension Panel](editor/extension/panel.md)
284281
- [Compose Panel](editor/extension/panel-boot.md)
285282
- [Panel Message](editor/extension/panel-messages.md)
@@ -292,7 +289,9 @@
292289
- [Extending the Assets Panel](editor/assets/extension.md)
293290
- [Extending the Project Settings Panel](editor/extension/contributions-project.md)
294291
- [Extending the Preferences Panel](editor/extension/contributions-preferences.md)
292+
- [Extend the Build Process](editor/publish/custom-build-plugin.md)
295293
- [Basic](editor/extension/basic.md)
294+
- [Extension Description](editor/extension/define.md)
296295
- [Extension](editor/extension/package.md)
297296
- [Message](editor/extension/messages.md)
298297
- [I18n](editor/extension/i18n.md)

en/asset/prefab.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Prefab is used to store some scene objects that can be reused, it can contain no
44

55
## Basic Concepts
66

7-
Name|Description|Example
8-
:---|:---|:---
9-
Prefab Asset|The asset of prefab in **Assets** panel, which is the serialize file of Prefab.|![prefab asset](prefab/prefab-asset.png)
10-
Prefab Instance|When the __Prefab Asset__ is drag to the `Hierarchy` panel, it will generate a __Prefab Instance__. Its root node is currently marked in bright green, and its child nodes are dark green|![prefab instance](prefab/prefab-instance.png)
11-
Prefab Editing Mode|Double-click the __Prefab Asset__ to enter the prefab editing mode. At this time, all non-nested prefab nodes are displayed in dark green|![prefab edit mode](prefab/prefab-edit-mode.png)
12-
Nested Prefab Instance|When a child node in a __Prefab Asset__ is an instance of another __Prefab Asset__, we call this child prefab a nested prefab instance|![nested-prefab](prefab/nested-prefab.png)
7+
| Name | Description | Example |
8+
| :--- | :--- | :--- |
9+
| Prefab Asset | The asset of prefab in **Assets** panel, which is the serialize file of Prefab.| ![prefab asset](prefab/prefab-asset.png) |
10+
| Prefab Instance | When the __Prefab Asset__ is drag to the `Hierarchy` panel, it will generate a __Prefab Instance__. Its root node is currently marked in bright green, and its child nodes are dark green | ![prefab instance](prefab/prefab-instance.png) |
11+
| Prefab Editing Mode | Double-click the __Prefab Asset__ to enter the prefab editing mode. At this time, all non-nested prefab nodes are displayed in dark green | ![prefab edit mode](prefab/prefab-edit-mode.png) |
12+
| Nested Prefab Instance | When a child node in a __Prefab Asset__ is an instance of another __Prefab Asset__, we call this child prefab a nested prefab instance | ![nested-prefab](prefab/nested-prefab.png) |
1313

1414
## Creating a Prefab
1515

@@ -29,6 +29,8 @@ In the __Scene__, the __Prefab Instance__ objects data source comes from the des
2929

3030
__Double-click__ the __Prefab Asset__ in the __Assets__ panel to switch from __Scene__ editing mode to __Prefab editing__ mode. You can edit the __Prefab Assets__ in the __Editor__. After editing, click __Save__ button in the __Scene__ panel to save the edited __Prefab Assets__. Next, click __Close__ button to return to the Scene editing mode.
3131

32+
> **Note**: please avoid multiple people modifying the same prefab asset at the same time, as this may lead to conflicts that cannot be resolved by `git` merging.
33+
3234
![edit mode](prefab/prefab-edit-mode.gif)
3335

3436
## Status of prefab nodes
@@ -43,12 +45,12 @@ In the __Hierarchy__ panel, select the __Prefab Node__, and notice there are sev
4345

4446
![edit prefab](prefab/edit-prefab.png)
4547

46-
Icon|Description
47-
:---|:---
48-
![unlink prefab](prefab/unlink-prefab-button.png)|Revert to __normal node__. __Prefab Instance__ can become ordinary __Nodes__, that is, completely separated from the relationship between assets. This function is also available in the top-level menu `Node`.
49-
![locate prefab](prefab/locate-prefab-button.png)|Locating assets.Its convenient to quickly locate __Prefab Asset__ in the __Assets__ panel.
50-
![revert prefab](prefab/revert-prefab-button.png)|Restore from asset. Restore the data of the current __Prefab Instance__ to the data in the __Prefab Asset__, but the name, location, and rotation will not be restored.
51-
![apply prefab](prefab/apply-prefab-button.png)|Update to asset. Update all data of the current __Prefab Instance__ to the associated __Prefab Asset__.
48+
| Icon | Description |
49+
| :--- | :--- |
50+
| ![unlink prefab](prefab/unlink-prefab-button.png) | Revert to __normal node__. __Prefab Instance__ can become ordinary __Nodes__, that is, completely separated from the relationship between assets. This function is also available in the top-level menu `Node`. |
51+
| ![locate prefab](prefab/locate-prefab-button.png) | Locating assets.Its convenient to quickly locate __Prefab Asset__ in the __Assets__ panel. |
52+
| ![revert prefab](prefab/revert-prefab-button.png) | Restore from asset. Restore the data of the current __Prefab Instance__ to the data in the __Prefab Asset__, but the name, location, and rotation will not be restored. |
53+
| ![apply prefab](prefab/apply-prefab-button.png) | Update to asset. Update all data of the current __Prefab Instance__ to the associated __Prefab Asset__. |
5254

5355
### Add New Node
5456

en/asset/release-manager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Releasing Of Resources
1+
# Releasing of Resources
22

33
> Author: Santy-Wang, Xunyi
44

en/asset/scene.md

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,76 @@
11
# Scene Assets
22

3-
In __Cocos Creator__, the __Scene__ is the cornerstone for organizing game content during development, and presenting all game content to the players. The __Scene__ itself is a file, also considered a game asset, and saves most of the game's information.
3+
In **Cocos Creator**, the **Scene** is the cornerstone for organizing game content during development, and presenting all game content to the players. The **Scene** itself is a file, also considered a game asset, and saves most of the game's information.
4+
5+
> **Note**: please avoid multiple people modifying the same scene asset at the same time, as this may lead to conflicts that cannot be resolved by `git` merging.
46
57
## Creating a Scene
68

7-
There are __three__ ways to create a __Scene__:
9+
There are **three** ways to create a **Scene**:
10+
11+
1. Select the folder to create the **Scene** file in the **Assets** panel. On the folder right-click and select **Create -> Scene**, and then type the desired **Scene** name.
812

9-
1. Select the folder where you want to create the __Scene__ file in the __Assets__. On the folder __Right click --> New --> Scene file__, and then type the desired __Scene__ name.
1013

1114
![new_scene_1](scene/new_scene_1.png)
1215

13-
In order to have a good directory structure in your project, it is strongly recommend that you use this method to create a __Scene__.
16+
In order to have a good directory structure in the project, it is strongly recommended that use this method to create a **Scene**.
17+
1418

15-
2. Click the __Create__ menu in the __Assets__ to create a new __Scene__.
19+
2. Click the **Create (+)** button in the upper left corner of the **Assets** panel, and then select **Scene**.
1620

1721
![new_scene_2](scene/new_scene_2.png)
1822

19-
3. Select __File -> New Scene__, a new __Scene__ will appear directly in the __Hierarchy__ panel, but a new __Scene__ will not appear in the __Assets__. You need to save it in the root of the asset folder. A `New Scene.scene` __Scene__ file appears in the directory.
23+
3. Select **File -> New Scene** in the top menu bar, a new scene will be created directly in the **Scene** panel. But the new scene file will not appear in the **Assets** panel, it is required to save the scene file manually in the **Save Scene** window that pops up when saving the scene, and the `scene.scene` file will appear in the root directory of the **Assets** panel only after the saving is done.
24+
2025

2126
![new_scene_3](scene/new_scene_3.png)
2227

2328
## Saving a Scene
2429

25-
While creating __Scenes__, you can quickly save __Scenes__ with the shortcut keys __Ctrl + S__ (Windows) or __Command + S__ (Mac).
30+
Method 1: Use the shortcut keys <kbd>Ctrl</kbd> + <kbd>S</kbd> (Windows) or <kbd>Command</kbd> + <kbd>S</kbd> (MacOS) to quickly save the scene.
2631

27-
## Switching Scenes
32+
Method 2: Select **File -> Save Scene** in the top menu bar.
2833

29-
In the __Assets__, __double-click__ the __Scene__ you want to open. When needing to switch __Scenes__ in the game, use the `director.loadScene()` API to implement dynamic scene loading and switching in the game. For further details, please see the [API documentation](__APIDOC__/en/classes/core.director-2.html#loadscene).
34+
## Switching Scenes
3035

31-
## Scene Asset Properties
36+
In the **Assets** panel, **double-click** the **Scene** to be opened.<br>
37+
When needing to switch **Scenes** in the game, use the [director.loadScene()](__APIDOC__/en/classes/core.director-2.html#loadscene) API to implement dynamic scene loading and switching in the game.
3238

33-
Since the __Scene__ is an __Asset__ a property can be set in the __Assets__ to load assets asynchronously.
39+
## Scene Properties
3440

35-
![scene set](scene/scene_set.png)
41+
After double-clicking to open the **scene** file, the `scene` is the root node of the scene node tree in the **Hierarchy** panel. Select the `scene` node, and set whether the scene is automatically released or not in the **Inspector** panel, as well as the whole scene related properties, including **ambient light** settings, **shadows** settings, **global fog** and **sky box** settings.
3642

37-
After opening the __Scene__ file, **Scene** is the root node of the __Scene__ node tree. Select the __Scene__ node in the __Hierarchy__ panel. In the __Inspector__ panel on the left, you can set the properties of the entire __Scene__, including **ambient light** settings, **shadow** settings and **sky box** settings.
43+
![scene_node](scene/scene_node.png)
3844

39-
![scene_node_set](scene/scene_node_set.png)
45+
Automatic release of scene assets, please refer to section **Change the policy of auto releasing assets from previous scene** below for details.
4046

41-
For a detailed description of each property, see the following documents:
47+
For a detailed description of each property, see the following documentations:
4248

4349
- [Ambient light](../concepts/scene/light/lightType/ambient.md)
4450
- [Shadow](../concepts/scene/light/shadow.md)
4551
- [Global Fog](../concepts/scene/fog.md)
4652
- [Skybox](../concepts/scene/skybox.md)
53+
54+
## Change the Policy of Auto Releasing Assets from Previous Scene
55+
56+
In a large game where there are many scenes, as the engine continues to load different scenes, the memory usage will continue to increase. Besides using API such as `assetManager.releaseAsset` to accurately release unused assets, one can also use scene's auto releasing feature.
57+
58+
59+
After double-clicking to open the scene file, select the `scene` node in the **Hierarchy** panel to set whether the scene is automatically released in the **Inspector** panel:
60+
61+
![scene node set](scene/scene_node_set.png)
62+
63+
When switching from current scene to the next scene, if current scene disabled the auto releasing, then all assets (directly or indirectly) referenced by current scene (except loaded dynamically in scripts) will not release by default. On the other hand, if enable the auto releasing, then these assets will release by default.
64+
65+
### Prevent auto releasing for some specified assets
66+
67+
With the auto releasing enabled for a scene, if some of the scene's assets are saved in the script as "special reference", these references will become invalid once the scene switched, since the asset has been released, may cause rendering problems. To prevent these assets from being released automatically, we can use [Asset.addRef](__APIDOC__/en/classes/asset.asset-1.html#addref) to retain them.
68+
69+
> "Special reference" refer to references in the form of global variables, singleton, closures, "dynamic assets", and so on.<br>
70+
> "Dynamic assets" refer to assets that are dynamically created or dynamically modified in a script.
71+
72+
The above content of the automatic release of scene assets can be summed up in the following diagram of several cases:
73+
74+
![release assets](scene/release-assets.png)
75+
76+
For additional information on asset release, please refer to the [Release of Assets](./release-manager.md#auto-release) documentation.

en/asset/scene/enable-extension.png

11.7 KB
Loading

en/asset/scene/new_scene_1.png

-7.25 KB
Loading

en/asset/scene/new_scene_2.png

407 Bytes
Loading

en/asset/scene/new_scene_3.png

15.4 KB
Loading

en/asset/scene/release-assets.png

88.9 KB
Loading

en/asset/scene/scene_node.png

16.6 KB
Loading

0 commit comments

Comments
 (0)