从虚幻引擎4中的级别蓝图访问变量 [英] access a variable from level blueprint in unreal engine 4

查看:338
本文介绍了从虚幻引擎4中的级别蓝图访问变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个变量,每当我在关卡蓝图中移动我的多维数据集时,该变量都会更新,现在我想从多个类蓝图中访问此变量,我该怎么做,我试图转换为gamestate但没有成功,我是ue4真的很新,如果您可以详细解释,请

I Have a variable that updates every time i move my cube in the level blueprint , now i want to access this variable from multiple class blueprints , what do I do , I tried casting to gamestate but didn't succeed , I am really new to ue4 if you could explain in details please

很抱歉没有添加详细信息, 我要访问的var是一个名为cube_side的整数,该整数告诉我每次移动时多维数据集位于哪一侧,所有这些都发生在bp级别中,我想访问此变量以查看多维数据集位于另一方的哪一侧类蓝图-> 这是图片中的一些细节

edit: sorry for not adding details , The var I want to access is an integer named cube_side that tells me what side the cube is on every time I move , all of this happens in the level bp , I want to access this variable to see what side the cube is on from other class blueprints -> here are some details in a picture

我知道在层级蓝图中编写所有代码并不好,但是现在为时已晚,我只需要将var cube_side转移到其他类蓝图上,以便另一个对象可以根据多维数据集所在的一侧进行更改.

I know it's not good to code everything in the level blueprint , but it's too late now , I only need to transfer the var cube_side to other class blueprints so the other object can change depending what side the cube is on.

推荐答案

为您的逻辑/功能创建Actor类.然后使用获取班级所有演员"(选择班级)->获取副本->获取变量

Create an Actor Class for your logic/functionality. Then use Get all actors of class (choose your class) -> Get a copy -> get variable

这篇关于从虚幻引擎4中的级别蓝图访问变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆