Skip to content

无法通过 cc.director.getScene().name 获得当前场景的名称. #18444

@finscn

Description

@finscn

Cocos Creator version

3.8.5

System information

all

Issue description

执行 cc.director.getScene().name 返回的是空字符串.

很多很多年前 有人问过类似问题 https://forum.cocos.org/t/1-3-2-cc-director-getscene-name/42358/4 (不过是老版本的 cocos)

我在网上也没搜到正确答案.

我这里选择的是 当前场景 .

Image

我觉得 无论用户是选择 当前场景 , 还是选择 某一个特定的 scene, 无论这个scene是放在某个bundle中 还是没有, 无论是开发模式 还是 预览模式 还是 release模式, "能够正确获得当前场景的名称" 都是一个基本能力.

Relevant error log output

No response

Steps to reproduce

.

Minimal reproduction project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageNeeds to be assigned by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions