H

UFUNCTION(BlueprintNativeEvent)

void EventName();

virtual void EventName_Implementation();

EventName事件发生时会调用这个函数

CPP

void ClassName::EventName_Implementation()

这个宏是UE4的强制内联函数,用于优化,返回Mesh的指针给Pickup

FORCEINLINE class UStaticMeshComponent *GetMesh() const { return PickupMesh;}

//BlueprintPure 此函数不会以任何方式影响其从属对象,并且可在蓝图或关卡蓝图图表中执行。

UFCUNTION相关

https://docs.unrealengine.com/latest/CHN/Programming/UnrealArchitecture/Reference/Functions/index.html

UFUNCTION(BlueprintPure, Category = "PickUp")

UFUNCTION(BlueprintCallable, Category = "PickUp")

UFUNCTION(BlueprintNativeEvent)

UFUNCTION(BlueprintImplementableEvent,Category="Power")

UPROPERTY相关

https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Properties/index.html

//这个属性就是可以让你在编辑器中修改组件,因为目前版本不加这个可能会无法修改吧,到时候试试看

UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="Power",Meta=(BlueprintProtected="true"))

UPROPERTY(VisibleAnywhere,BlueprintReadOnly,Category="Pickup",meta=(AllowPrivateAccess ="true"))

class UStaticMeshComponent *PickupMesh;

———————————————————————————————

总结一下,需要与蓝图交互的函数与变量会使用UFUNCTION,UPROPERTY宏,不需要的这不需要使用这些宏。

案例中使用的随机数相关代码

包含头文件

#include "Kismet/KismetMathLibrary.h"

FMath::FRandRange(float inMin,float inMax)

HUD部分

之前需要在项目中的CS文件中添加UMG模块之后,在对应的CPP文件中添加,不过我不太建议在C++文件中做HUD操作

PrivateDependencyModuleNames.AddRange(newstring[]{"Slate","SlateCore"});

#include "Blueprint/UserWidget.h"

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Power", Meta = (BlueprintProtected = "true"))

TSubclassOf<class UUserWidget> HUDWidgetClass;

HUD实例

UPROPERTY()

class UUserWidget *CurrentWidget;

if (HUDWidgetClass!=nullptr)

{

CurrentWidget = CreateWidget<UUserWidget>(GetWorld(), HUDWidgetClass);

if (CurrentWidget!=nullptr)

{

CurrentWidget->AddToViewport();

}

}

Ue4 BatteryCollector 教程笔记的更多相关文章

  1. jQuery官方基础教程笔记(转载)

    本文转载于阮一峰的博文,内容基础,结构清晰,是jquery入门不可多得的资料,非常好,赞一个. 阮一峰:jQuery官方基础教程笔记 jQuery是目前使用最广泛的javascript函数库. 据统计 ...

  2. 简单脱壳教程笔记(2)---手脱UPX壳(1)

    本笔记是针对ximo早期发的脱壳基础视频教程,整理的笔记. ximo早期发的脱壳基础视频教程 下载地址如下: http://down.52pojie.cn/%E5%90%BE%E7%88%B1%E7% ...

  3. Docker 入坑教程笔记

    Docker 入坑教程笔记 视频网址B站:点这里 查询命令 man docker 简单启动和退出 docker run --name [容器名] -i -t ubuntu /bin/bash 交互启动 ...

  4. Verilog HDL实用教程笔记

    Verilog HDL实用教程笔记 DRC - Design Rule Check 几何规则检查ERC - Electrical Rule Check 电学规则检查自动参数提取LVS - Logic ...

  5. 无废话MVC入门教程笔记

    自学mvc,看了园子里李林峰写的李林峰写的无废话MVC入门教程笔记,现在有的平时忽略的或是不太清楚的点记下来 1,Html.DropDownList //服务端写法 @{ //下拉列表的值 List& ...

  6. [转]赵桐正thinkphp教程笔记

    原文:赵桐正thinkphp教程笔记 ,有修改 常用配置 常用配置config.php: <?php return array( //'配置项'=>'配置值' 'URL_PATHINFO_ ...

  7. swift基础教程笔记

    http://www.imooc.com/learn/127 <玩儿转swift> 慕课网教程笔记,自己根据2.1的语法做了更新. I. 1.通过playground来学习.熟悉swift ...

  8. 2019-03-22 Python Scrapy 入门教程 笔记

    Python Scrapy 入门教程 入门教程笔记: # 创建mySpider scrapy startproject mySpider # 创建itcast.py cd C:\Users\theDa ...

  9. Swagger快速入门教程笔记

    现在市面上大多数公司都摒弃了传统 jsp 开发,采用前后端分离式的开发规则,前端使用 Vue,Angular,React 等等完成页面,后端省掉了视图跳转的过程,直接书写接口返回 json 数据供前端 ...

随机推荐

  1. 关于ActionContext.getContext()的用法心得

    转: 为了避免与Servlet API耦合在一起,方便Action类做单元测试,Struts 2对HttpServletRequest.HttpSession和ServletContext进行了封装, ...

  2. 多线线程async与await关键字

    创建线程 //这里面需要注意的是,创建Thread的实例之后,需要手动调用它的Start方法将其启动. //但是对于Task来说,StartNew和Run的同时,既会创建新的线程,并且会立即启动它. ...

  3. Android Message Handling Mechanism

    转自:http://solarex.github.io/blog/2015/09/22/android-message-handling-mechanism/ Android is a message ...

  4. Ubuntu中给eclipse和android studio添加桌面快捷图标

    Ubuntu 12.04 创建应用程序启动项(可在Unity LaucherPad显示) http://www.cnblogs.com/bluestorm/archive/2012/10/12/272 ...

  5. Linux Shell 高级编程技巧2----shell工具

    2.shell工具    2.1.日志文件        简介            创建日志文件是很重要的,记录了重要的信息.一旦出现错误,这些信息对于我们排错是非常有用的:监控的信息也可以记录到日 ...

  6. Mongo DB Study: first face with mongo DB

    Mongo DB Study: first face with mongo DB 1.  study methods: 1.  Translate: I am the mongo DB organiz ...

  7. SQL集合操作符样例(UNION,INTERSECT,EXCEPT)

    由于MYSQL目前只实现了UNION, 所以后面两个就没得玩罗.... SELECT emp_id, assigned_branch_id -> FROM employee -> WHER ...

  8. Javascript事件冒泡机制

    1. 事件 在浏览器客户端应用平台,基本生都是以事件驱动的,即某个事件发生,然后做出相应的动作. 浏览器的事件表示的是某些事情发生的信号.事件的阐述不是本文的重点,尚未了解的朋友,可以访问W3scho ...

  9. [Java] 使用Java Visual VM寻找PermGen Space的解决办法

    在Eclipse使用tomcat运行3个项目时,老是报这个错误,以下为错误详情: 2014-5-28 13:47:41 org.apache.catalina.core.StandardWrapper ...

  10. HDU 5787 K-wolf Number 数位DP

    K-wolf Number Problem Description   Alice thinks an integer x is a K-wolf number, if every K adjacen ...