如何在小部件和关卡蓝图之间进行通信?

huangapple go评论54阅读模式
英文:

How do i communicate between a widget and level blueprint?

问题

我想制作一个带有重新开始按钮的小部件,但我不知道应该如何告诉关卡蓝图我点击了按钮。而且无法将玩家起始对象传递到小部件蓝图中。我已经在互联网上搜索,但没有找到答案。

英文:

I want to make a widget that has a restart button, but I have no idea how I'm supposed to tell the level blueprint that I clicked the button. And there's no way to get the player start object into the widget blueprint.

I've scraped the internet to no avail.

答案1

得分: 0

以下是您要翻译的内容:

"根据我所知,通过小部件无法与级别蓝图进行通信。我不确定您试图做什么,因为您可以在小部件上使用“点击”事件来执行重生代码。我建议避免使用级别蓝图,因为它更难转换。我建议使用类似游戏实例、玩家角色、甚至游戏模式或演员的东西。请查阅虚幻引擎文档:https://docs.unrealengine.com/5.0/en-US/BlueprintAPI/Utilities/Casting/ https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Utilities/GetActorOfClass/"

英文:

it is not possible to talk to the level blueprint through a widget as far as i know. I'm not sure what you are trying to do as you could just execute the respawn code through the widget using on clicked. I would stay away from using the level blueprint as it is harder to cast to. I would use something like a game instance,player charater or even the game mode or an actor.
See unreal documentation...
https://docs.unrealengine.com/5.0/en-US/BlueprintAPI/Utilities/Casting/
https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Utilities/GetActorOfClass/

huangapple
  • 本文由 发表于 2023年5月7日 01:35:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76190257.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定