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

[UE] mixin除了spawn外,可以对运行中的被mixin的蓝图生效吗 #1918

Open
Meidozuki opened this issue Nov 16, 2024 · 6 comments
Open

Comments

@Meidozuki
Copy link

detail | 详细描述

看了mixin的示例,都是在TS中new或者spawn出来
如果我想修改一个BP,但这个BP已经在场景中存在了,我应该怎么做

另外,我写了如下的代码,但是重启后"Elevator mixed in"就不打印了,是我的使用方式出错了吗

'''
interface ElevatorMixin extends UE.Elevator {};

class ElevatorMixin{
OnBeginRunning(): void {
LoggerUtils.log("TS_ElevatorMixin", "begin running")
}
}

blueprint.mixin(UE.Elevator, ElevatorMixin)
console.log("Elevator mixed in")
'''

@chexiongsheng
Copy link
Collaborator

重启啥?

@Meidozuki
Copy link
Author

重启啥?

重启编辑器,重启编辑器后的log里就没有"Elevator mixed in"了

@chexiongsheng
Copy link
Collaborator

上一个虚拟机都销毁了你还想生效啊?
要重新mixin。
你也可以自己做些自动化的工作。

@Meidozuki
Copy link
Author

上一个虚拟机都销毁了你还想生效啊? 要重新mixin。 你也可以自己做些自动化的工作。

也就是说,写在TS全局作用域的语句,不一定会被执行?
ok那我再看看其他的实现方法

@chexiongsheng
Copy link
Collaborator

chexiongsheng commented Nov 22, 2024

加载这个脚本会执行

@chexiongsheng
Copy link
Collaborator

或者说第一次require的时候执行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants