Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Scene.load(url, complete, progress) 能不能把内嵌其他ui资源也一起加载了 #371

Closed
zsytssk opened this issue Sep 2, 2020 · 2 comments

Comments

@zsytssk
Copy link

zsytssk commented Sep 2, 2020

比方说一个场景A中使用了ui B,B下面有节点C;
现在在A load之后,B并没有加载;
如果在A的onEnable中使用B.C 就会报错;
现在我只能将B变成内嵌资源,没发现其他好的方式。。。

@chenshch
Copy link

chenshch commented Sep 2, 2020 via email

@zsytssk
Copy link
Author

zsytssk commented Sep 11, 2020

@chenshch

我觉得你应该换个思路,这种逻辑应该放在C里处理,而不是B。B只负责通知C处理,不用B.C

------------------ 原始邮件 ------------------ 发件人: "张世阳"<notifications@github.com>; 发送时间: 2020年9月2日(星期三) 下午4:17 收件人: "layabox/LayaAir"<LayaAir@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [layabox/LayaAir] Scene.load(url, complete, progress) 能不能把内嵌其他ui资源也一起加载了 (#371) 比方说一个场景A中使用了ui B,B下面有节点C; 现在在A load之后,B并没有加载; 如果在A的onEnable中使用B.C 就会报错; 现在我只能将B变成内嵌资源,没发现其他好的方式。。。 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

实际上我只有A绑定一个脚本 B C 都没有, 在很多时候都是这样的(如果你用laya做过游戏就会明白);
即使你说的那种方式 也是不行的, 比方说 A和B都都绑定一个脚本;
A中调用A.B只能是在A.onEnabled之后才可以, 调用B.C只能在B.onEabled之后才行, 我在A中不能知道B什么时候onEabled
如果我在A.onEnabled马上调用B中引用C的方法就会出错...(这你应该没有疑问吧);


这个问题的关键是父UI并不能不能知道子UI什么加载完成, 引擎没有提供相应的api(也许有我不知道,如果有希望你能说下), 而这我觉得是一个基础的功能, 引擎应该提供的...

@layabox layabox locked and limited conversation to collaborators Mar 1, 2024
@xiaoguzhu xiaoguzhu converted this issue into discussion #1362 Mar 1, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants