蓝图引用的问题

[复制链接]
查看2202 | 回复7 | 2016-12-26 14:05:41 | 显示全部楼层 |阅读模式
我在名为distance的蓝图中写如下的函数(计算两点空间距离)
捕获.PNG
在关卡蓝图中写了如下内容,其中引用了distance中的函数
捕获2.PNG

New Var 0 就是引用的蓝图,左边眼睛点亮了
3.PNG

但是报错:
错误 Blueprint Runtime Error: Accessed None trying to read property NewVar_0 from function: 'ExecuteUbergraph_Minimal_Default' from node: F Distance in graph: EventGraph in object: Minimal_Default with description: Accessed None trying to read property NewVar_0


而且输出的数值是0

printscreen | 2016-12-26 14:33:48 | 显示全部楼层
直接distance to节点不就行了吗
回复 支持 反对

使用道具 举报

mofans | 2016-12-26 15:41:41 | 显示全部楼层
new var0没有赋值
回复 支持 反对

使用道具 举报

spphins | 2016-12-26 20:47:01 | 显示全部楼层
wuyukang 发表于 2016-12-26 14:29
提示目标无效,你因该把New Var0删掉。话说计算两点距离用得着这么麻烦?直接用一个GetDistanceTo节点就行 ...

删除后New Var0 不能用里面的函数啊。
我是想在关卡蓝图里 用其他蓝图的函数
回复 支持 反对

使用道具 举报

spphins | 2016-12-26 20:50:08 | 显示全部楼层
本帖最后由 spphins 于 2016-12-26 20:51 编辑
怎么赋值,在level中创建一个distance蓝图的实例吗?
5.PNG
回复 支持 反对

使用道具 举报

40412440 | 2016-12-26 21:21:47 | 显示全部楼层
distance蓝图  把这个蓝图拖进场景中即可!
补充: 拖进场景中,选择这个蓝图.在关卡蓝图中右键.即可引用它
回复 支持 反对

使用道具 举报

spphins | 2016-12-27 17:45:14 | 显示全部楼层
本帖最后由 spphins 于 2016-12-27 18:13 编辑
40412440 发表于 2016-12-26 21:21
distance蓝图  把这个蓝图拖进场景中即可!
补充: 拖进场景中,选择这个蓝图.在关卡蓝图中右键.即可引用它
...

拖入场景中在引用的方法我成功了。但是添加变量的方法还是没有成功(即使我把distance拖入到了level中)


更新:
我看了官方文档 Direct Blueprint Communication is the most common method of Blueprint Communication and is great for when you have two Blueprints that you know you want to have talk to each other at some point. This type of communication is always one-to-one; meaning one Blueprint (the "Working Blueprint") is requesting to access another Blueprint (the "Target Blueprint"). The simplest way to use Direct Blueprint Communication is to get a reference to the Target Blueprint through a publicly exposed object Variable and then specify which instance of that Blueprint you want to access.
红字说要要有一个实例。。。但这个不能赋值
捕获.PNG
https://docs.unrealengine.com/la ... rintComs/index.html
回复 支持 反对

使用道具 举报

mofans | 2016-12-28 09:49:23 | 显示全部楼层
spphins 发表于 2016-12-26 20:50
怎么赋值,在level中创建一个distance蓝图的实例吗?

1.在level蓝图中创建一个distance,然后赋值给new  var_0变量
2.拖distance到场景中,在level蓝图中引用它
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

7

主题

66

回帖

541

积分

初阶编码师

积分
541