UE4.12.5-C++ 网络复制 Net/UnrealNetwork.h
2016-09-05 17:27
816 查看
--------------2016.9.5----------------李明阳-----------------------
参考SurvivalGame.h
// Thisis NOT included by default in an empty project! It's required for replicationand setting of the GetLifetimeReplicatedProps
#include"Net/UnrealNetwork.h"
Include后声明网络复制变量或函数
编译也会提示“无法解析的外部符号”,如下:
*/
UPROPERTY(Transient, Replicated)
bool bIsJumping;
UFUNCTION(Reliable, Server, WithValidation)
voidServerDropWeapon();
并不是上面的代码写得不对,编译不过是因为使用网络复制还需要一个函数GetLifetimeReplicated,DOREPLIFETIME。
以变量bool bIsJumping;为例,cpp中需要加如下代码可成功编译。
OutLifetimeProps)
const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// Value is already updated locally, skip in replication step
DOREPLIFETIME_CONDITION(ASCharacter, bIsJumping,
COND_SkipOwner);
/* If we did not display the current inventory on the player mesh we couldoptimize replication by using this replication condition. */
/* DOREPLIFETIME_CONDITION(ASCharacter, Inventory, COND_OwnerOnly);*/
}
UE4.12.5-C++ 网络复制 Net/UnrealNetwork.h
#include"Net/UnrealNetwork.h"
使用网络复制需要在项目名称头文件夹中#include"Net/UnrealNetwork.h"参考SurvivalGame.h
// Thisis NOT included by default in an empty project! It's required for replicationand setting of the GetLifetimeReplicatedProps
#include"Net/UnrealNetwork.h"
Include后声明网络复制变量或函数
编译也会提示“无法解析的外部符号”,如下:
Character.h
/* Is character currently performing a jump action. Resets on landed.*/
UPROPERTY(Transient, Replicated)
bool bIsJumping;
UFUNCTION(Reliable, Server, WithValidation)
voidServerDropWeapon();
并不是上面的代码写得不对,编译不过是因为使用网络复制还需要一个函数GetLifetimeReplicated,DOREPLIFETIME。
以变量bool bIsJumping;为例,cpp中需要加如下代码可成功编译。
Character.cpp
voidASCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>&OutLifetimeProps)
const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// Value is already updated locally, skip in replication step
DOREPLIFETIME_CONDITION(ASCharacter, bIsJumping,
COND_SkipOwner);
/* If we did not display the current inventory on the player mesh we couldoptimize replication by using this replication condition. */
/* DOREPLIFETIME_CONDITION(ASCharacter, Inventory, COND_OwnerOnly);*/
}
相关文章推荐
- UE4.12.5-C++ 网络复制 Net/UnrealNetwork.h
- C# System.Net.NetworkInformation 命名空间学习之NetworkInterface 类获取IP,DNS,Gateway,Mask, MAC等网络相关信息
- [神经网络]1.6-Using neural nets to recognize handwritten digits-Implementing our network to classify(翻译)
- Network Programming in .NET 网络编程,有大量API
- 【UNREAL ENGINE 游戏开发】开篇之UE4的BLUEPRINT(蓝图)与C++(新童鞋必看)
- UE4 C++ 读取网络图片显示到UI上
- [神经网络]1.4-Using neural nets to recognize handwritten digits-A simple network to classify ...(翻译)
- UE4网络复制Tips
- 笔记:C++设计模式——适配器模式:对象适配器(复制自网络)
- network+broadcast+netmask -- 第二章、基础网络概念
- [unreal4入门系列之十一] 在UE4中编写C++代码控制角色
- 对 www.networkdictionary.com 网络大典 致歉信
- D3dFvf顶点格式的C++描述(vc.net版)
- NetSaint随时监控网络
- C++: The Most Powerful Language for .NET Framework Programming
- Visual C#.Net 网络程序开发-Socket篇
- M.E. Bring .NET CLR Support to C++中文版(上篇)
- 对 www.networkdictionary.com 网络大典 致歉信
- Asp.net+Xml开发网络硬盘
- 用ASP.NET创建网络相册