英文:
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/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论