BlueprintType,使当前类可以作为蓝图中的类型使用。新建一个继承UObject的C++类CustomObject:
![](https://img-blog.csdnimg.cn/img_convert/1140cc31719f172737b109207a2dd34c.png)
![](https://img-blog.csdnimg.cn/img_convert/7ec8da441d264facbf82d0a387c1a59d.png)
UObject默认是无法作为蓝图中的类型使用的,打开关卡蓝图,声明一个CustomObject变量:
![](https://img-blog.csdnimg.cn/img_convert/a4d10b6a33340181fe3d1521c87a0d59.png)
可以看到,这里无法声明CustomObject类型的变量,我们为CustomObject添加BlueprintType标记宏:
![](https://img-blog.csdnimg.cn/img_convert/803ad9c8504dcb3a96e417e04e4d0cda.png)
![](https://img-blog.csdnimg.cn/img_convert/65dc5534972a3ecb4e4d584094500128.png)
这样我们自定义的类就能作为蓝图类型使用了
NotBlueprintType,使当前类不可作为蓝图类型使用。新建一个C++类CustomActor,继承AActor:
![](https://img-blog.csdnimg.cn/img_convert/ecf5f1335d31e063644cfc8f7829f6bd.png)
Actor类默认是可以作为蓝图类型使用的,我们在关卡蓝图中声明一个CustomActor变量:
![](https://img-blog.csdnimg.cn/img_convert/648f70b97fd6d309e3e9fe193675474a.png)
然后给CustomActor添加NotBlueprintType标记宏:
![](https://img-blog.csdnimg.cn/img_convert/073597024b0675a54275b92fd023df87.png)
![](https://img-blog.csdnimg.cn/img_convert/3f8cb2f94a897bdaef16cd22cf1b951f.png)
这样就可以禁止C++中的类作为蓝图中的类型使用。
那么好玩的来了,如果一个蓝图类型的变量中含有一个非蓝图类型的变量时,能否在蓝图中使用呢?在添加BlueprintType的CustomObject中声明添加了NotBlueprintType的CustomActor变量:
![](https://img-blog.csdnimg.cn/img_convert/732101d89ff0c7207505cf090d31e5cb.png)
![](https://img-blog.csdnimg.cn/img_convert/31f7530b405ac043a5fd703315aeef19.png)
可以看到,只要成员变量属性是BlueprintReadOnly或者BlueprintReadWrite修饰的,都能在蓝图中使用,NotBlueprintType只是禁止了在蓝图中声明变量时选择该类型。
ClassGroup,用来标记component组件类,给组件分组。
![](https://img-blog.csdnimg.cn/img_convert/7a8b10498b47fd0c9f221f18a5c280cd.png)
新建一个CustomComponent类,继承UActorComponent,并修改他的ClassGroup为Customponent:
![](https://img-blog.csdnimg.cn/img_convert/374bb7f916a725152051925a0e2fe0e8.png)
![](https://img-blog.csdnimg.cn/img_convert/5bbd16152f171a94073f77d1e632a68a.png)
这样我们的组件就会在CustomComponent分类中。
Blueprintable,使当前类能够被蓝图类继承。继承UObject的C++类,默认是不能被蓝图类继承的:
![](https://img-blog.csdnimg.cn/img_convert/b34a6b24b561ab632285ae56f2b31881.png)
给他加上Blueprintable标记:
![](https://img-blog.csdnimg.cn/img_convert/15a99d713ceb8f5a62350b5504a891cf.png)
![](https://img-blog.csdnimg.cn/img_convert/a15c9598f8b61f82fd4cde5dc0024d57.png)
这样,蓝图类就能继承它了。
NotBlueprintable,禁止当前类被蓝图类继承。继承AActor的C++类,默认是可以被蓝图类继承的:
![](https://img-blog.csdnimg.cn/img_convert/bc6e3b872609391dfbf0a43108cff87a.png)
给CustomActor添加NotBlueprintable标记:
![](https://img-blog.csdnimg.cn/img_convert/d111c9e9d5b24e9e1491c640d81bfee9.png)
![](https://img-blog.csdnimg.cn/img_convert/62762e123d394300ac2bbaa7a828cfa8.png)
这样蓝图类就无法继承此类了。
Config,可以对类中的变量进行自动本地化读写,用法见:http://t.csdn.cn/htTJJ