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

Add prefab doc #2270

Merged
merged 3 commits into from
Aug 2, 2024
Merged

Add prefab doc #2270

merged 3 commits into from
Aug 2, 2024

Conversation

luzhuang
Copy link
Contributor

@luzhuang luzhuang commented Jul 26, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

Summary by CodeRabbit

  • New Features
    • Introduced a comprehensive guide on Prefabs in game development, detailing functionality, creation, and management.
    • Provided instructions for updating, disconnecting, and deleting Prefabs, along with their implications.
    • Included scripting guidance for loading and instantiating Prefabs using the engine's resource manager.

Copy link

coderabbitai bot commented Jul 26, 2024

Walkthrough

This update introduces a comprehensive guide on Prefabs in game development, emphasizing their role as reusable templates for entities. It details the processes for creation, updating, disconnection, and deletion of Prefabs, alongside scripting instructions for instantiation. This resource aims to enhance developers' efficiency and management of game assets across various scenes.

Changes

Files Change Summary
docs/zh/core/prefab.md Introduced the guide on Prefabs, covering their definition, functionality, advantages, creation methods, updating process, disconnection, deletion implications, and scripting guidance for instantiation.

Poem

In fields of code where dreams take flight,
Prefabs hop in, a wondrous sight.
Templates to craft, so easy to share,
With joy and ease, we build in the air!
Oh, dance through the scenes, let creativity bloom,
Together we'll thrive, in our cozy dev room! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jul 26, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 43d9f86 and 2ce6fc6.

Files selected for processing (1)
  • docs/zh/core/prefab.md (1 hunks)
Additional context used
Markdownlint
docs/zh/core/prefab.md

14-14: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)

Additional comments not posted (4)
docs/zh/core/prefab.md (4)

8-13: LGTM!

The introduction section is clear and provides a good overview of prefabs and their benefits.


28-81: LGTM!

The editor usage section is clear and provides detailed instructions with helpful images.


71-74: LGTM!

The section on unlinking prefab instances is clear and provides detailed instructions with helpful images.


84-98: LGTM!

The section on using scripts to load and instantiate prefabs is clear and provides a helpful code example.


如果要在场景中的多个位置或项目中的多个场景之间重用以特定方式配置的实体,比如非玩家角色 (NPC)、道具或景物,则应将此游戏对象转换为预制体。这种方式比简单复制和粘贴游戏对象更好,因为预制体可以保持所有副本同步。

#### 预制体的主要特点:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the heading level.

The heading level should increment by one level at a time.

- #### 预制体的主要特点:
+ ### 预制体的主要特点:
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#### 预制体的主要特点:
### 预制体的主要特点:
Tools
Markdownlint

14-14: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)

@luzhuang luzhuang mentioned this pull request Jul 26, 2024

### 加载预制体
预制体资产的引擎对象为[PrefabResource](/apis/loader/#PrefabResource})。
加载([资产的加载](/docs/assets-load))预制体后,使用[instantiate](/apis/loader/#PrefabResource-instantiate})方法可以生成prefab实例。
Copy link
Collaborator

@cptbtptpbcptdtptp cptbtptpbcptdtptp Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加载预制体资产可以得到 PrefabResource 对象,使用instantiate方法可以得到 Prefab 实例化后的 Entity 对象。

![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*WC8ZTIv5MK4AAAAAAAAAAAAADsJ_AQ/original)

### 解开预制体实例
如果我们想让一个预制体实例与预制体断开联系,使其不随着预制体更改而更改,我们可以将预制体实例解开
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果想让一个预制体实例与预制体断开联系,使其不随着预制体更改而更改,可以将预制体实例解开

Copy link
Collaborator

@cptbtptpbcptdtptp cptbtptpbcptdtptp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2ce6fc6 and e3e52d5.

Files selected for processing (1)
  • docs/zh/core/prefab.md (1 hunks)
Additional comments not posted (7)
docs/zh/core/prefab.md (7)

8-12: LGTM!

The introduction section is clear and well-written.


14-14: Fix the heading level.

The heading level should increment by one level at a time.

- #### 预制体的主要特点:
+ ### 预制体的主要特点:

16-26: LGTM!

The content listing the main features of prefabs is clear and well-written.


28-86: LGTM!

The instructions on how to use prefabs in the editor are clear and well-written.


90-92: Fix the documentation content.

The documentation content for loading prefabs should be fixed.

- 预制体资产的引擎对象为[PrefabResource](/apis/loader/#PrefabResource})。
+ 预制体资产的引擎对象为[PrefabResource](/apis/loader/#PrefabResource)。

91-93: LGTM!

The instructions on how to use prefabs in scripts are clear and well-written.


94-102: LGTM!

The code block example is clear and well-written.

@cptbtptpbcptdtptp cptbtptpbcptdtptp merged commit 73f3b00 into galacean:dev/1.3 Aug 2, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants