cocos / cocos/cocos-engine

直接修改 prefab文件中 spirte 的 sizeMode 后, 在编辑器里打开无效.

Open
#19,081 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage
Dominant language
C++
Stars
9.8k
Forks
2.1k
Avg merge
12h 42m
Merged PRs (30d)
13

Description

Cocos Creator version

3.8.7

System information

all

Issue description

我的项目中很多 prefab , 它们的 sprite的 sizeMode 默认使用了 custom . 节点的 content size 为 100 * 100.

我现在通过外部脚本 直接修改这些 prefab文件的 sprite的 sizeMode 为 raw.
期望的结果是, 在编辑器里 打开这些 prefab 时, 自动更新 content size 为 图片实际大小.
以前 2.4.x 也确实是这种逻辑.

但是目前 3.8.x 里不是这个逻辑了. 我在外部修改为 raw 后, 在编辑器里打开 prefab, node 的 content size 还是为之前的值.

在编辑器里修改 sizeMode 的话, content size 是会自动同步更新的.

Relevant error log output

No response

Steps to reproduce

如上

Minimal reproduction project

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in Cocos Creator 3.8.7: edit a prefab externally so its Sprite sizeMode changes from custom to raw, then open it in the editor. Compare this with changing sizeMode in the editor; done means opening the externally modified prefab updates the node content size to the image’s actual dimensions.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.