一句简单的话就够了,多一个字也多了。
名字版Widget的设计习惯
用全窗口尺寸设计,设计的时候设置大小,嵌入的时候设置成同样的大小
禁止客户端发送Camera更新消息
如果不是Full 3D的客户端,不需要每帧都发送Camera的位姿数据,就算Full 3D,也是过于频繁了,毕竟还有Actor的位姿数据每帧都会发送
void AUserPlayerController::PostInitializeComponents(){
Super::PostInitializeComponents();
ensure(PlayerCameraManager);
if(PlayerCameraManager){PlayerCameraManager->bUseClientSideCameraUpdates = false;}
}
取执行程序的目录
FPaths::Combine(*FPaths::GameDir(), TEXT("Binaries"), FPlatformProcess::GetBinariesSubdirectory(), TEXT("luaclib"));
--->ProjectName/Binaries/Win64/luaclib
动态组件的进化
一般在构造函数里用CreateDefaultSubobject创建组件
Creating and Attaching Components
在其他地方创建组件,必须用ConstructObject
后来这个方法被depreciate了,现在用NewObject
UObject配置文件
GetGlobalUserConfigFilename:C:/Users//AppData/Local/Unreal Engine/Engine/Config/UserMySettings.ini
USensorSettings GetDefaultConfigFilename:../../../../
/Config/DefaultMySettings.ini
USensorSettings GetConfigFilename:
/Saved/Config/Windows/MySettings.ini
error:Package contains EditorOnly data
如果在Game中使用了引擎资源,加载场景就会报这种错误。解决:
查找和修改代码或BP中有使用“Engine/EditorMeshes”路径下的资源。
调整近裁剪面距离
\Config\DefaultEngine.ini
[/Script/Engine.Engine]
NearClipPlane=1
LightmassImportanceVolume
LightingResults:Warning: Performance Warning No importance volume found and the scene is so large that the automatically synthesized volume will not yield good results. Please add a tightly bounding lightmass importance volume to optimize your scene's quality and lighting build times.
自动插入Engine StarterContent
[StartupActions]
bAddPacks=True
InsertPack=(PackSource="StarterContent.upack",PackName="StarterContent")
NewObject
NewObject(UObject*Outer, UClass* Class)
在对象里GetOuter可以取回NewObject时传入的指针
How many ways to get World
<占位描述>
UWorldProxy WorldProxy = GWorld;
UWorld* world = GEngine->GetWorld();
USTRUCT() vs USTRUCT(BlueprintType)
USTRUCT()
struct FQuestInProgress
???
Enable GameplayAbilities
Enable in plugin or modify uproject
"Plugins": [
{
"Name": "GameplayAbilities",
"Enabled": true
}
]
GameAbility\Config\DefaultEngine.ini
[GameplayAbilities]
GameplayAbilitiesEditorEnabled=true
Landscape Splines快捷键
ref:
Landscape Splines
鼠标左键
选中一个point或一个segment
Shift+鼠标左键
多选
Ctrl+鼠标左键
产生多个效果。如果当前选中的是一个segment,然后你点击到其上某点,则创建一个新的控制点。如果选中point后执行,则试了就知道。
R
自动计算控制点的Rotation
T
自动计算Tangent
F
Flip Segment
End
Snaps control points to Landscape
VCToolChain
UnrealBuildTool.VCToolChain.AppendCLArguments_Global()
UPARAM(ref)
如果参数是引用,则默认情况下是一个out pin。UPARAM(ref)正好逆反这个行为。
UPARAM wiki
UPARAM(DisplayName)
修改pin label 的显示名字
UPARAM wiki
版本判断
// check unreal engine
#ifdef _MSC_VER
#include "../../../Launch/Resources/Version.h"
#if ENGINE_IS_PROMOTED_BUILD
#define _VALUE_TO_STRING(x) #x
#define _VALUE(x) _VALUE_TO_STRING(x)
#define _VAR_NAME_VALUE(var) #var "=" VALUE(var)
#pragma message("------ Using offical Unreal engine " _VALUE(BUILT_FROM_CHANGELIST) )
#else
#pragma message("------ Using custom build Unreal engine")
#endif
#endif //~ _MSC_VER
相机绕轴旋转
Performance
Performance and Profiling
How to Setup Automatic LOD Generation
Performance Guidelines for Artists and Designers
遍历目录下的文件
TArray<FString> Files;
FPackageName::FindPackagesInDirectory(Files, FString::Printf(TEXT("%s/Content/Maps"), *FPaths::GameDir()));
Module Implemention
Detail Customization
<占位项1>
<占位项2>
Enum
Engine\Source\Runtime\Engine\Classes\Engine\EngineTypes.h
UENUM(BlueprintType)
namespace EEndPlayReason
{
enum Type
{
/** When the Actor or Component is explicitly destroyed. */
Destroyed,
/** When the world is being unloaded for a level transition. */
LevelTransition,
/** When the world is being unloaded because PIE is ending. */
EndPlayInEditor,
/** When the level it is a member of is streamed out. */
RemovedFromWorld,
/** When the application is being exited. */
Quit,
};
}
禁用precompiled heade
在ModuleRules的构造里加入:PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
查看引擎剔除的对象
r.visualizeocculsion 1
IWYU(Include-What-You-Use)
IWYU 参考指南
IWYU 在游戏和游戏插件中默认禁用,但在引擎和引擎插件中默认启用。
<占位项2>
判断一个方法在BP里有没有实现
UGameplayAbility()
{
auto ImplementedInBlueprint = [](const UFunction* Func) -> bool
{
return Func && ensure(Func->GetOuter())
&& (Func->GetOuter()->IsA(UBlueprintGeneratedClass::StaticClass())
|| Func->GetOuter()->IsA(UDynamicClass::StaticClass()));
};
{
static FName FuncName = FName(TEXT("K2_ShouldAbilityRespondToEvent"));
UFunction* ShouldRespondFunction = GetClass()->FindFunctionByName(FuncName);
bHasBlueprintShouldAbilityRespondToEvent = ImplementedInBlueprint(ShouldRespondFunction);
}
}
Android signing
Signing Projects for Release
<占位项1>
<占位项2>
屏幕打印
C++
UKismetSystemLibrary::PrintString
BP:
Print String
C++中判断某BP方法是否存在
参考:GameplayAbilities\Private\Abilities\GameplayAbility.cpp
auto ImplementedInBlueprint = [](const UFunction* Func) -> bool
{
return Func && ensure(Func->GetOuter())
&& (Func->GetOuter()->IsA(UBlueprintGeneratedClass::StaticClass()) || Func->GetOuter()->IsA(UDynamicClass::StaticClass()));
};
{
static FName FuncName = FName(TEXT("K2_ShouldAbilityRespondToEvent"));
UFunction* ShouldRespondFunction = GetClass()->FindFunctionByName(FuncName);
bHasBlueprintShouldAbilityRespondToEvent = ImplementedInBlueprint(ShouldRespondFunction);
}
BP转C++
Converting From Blueprints to C++
指定Visual Studio版本
"%UE4_DIR%\Engine\Binaries\DotNET\UnrealBuildTool.exe" -projectfiles -project="%~dp0\TestTopDown.uproject" -2015
占位标题
<占位项1>
<占位项2>
占位标题
<占位项1>
<占位项2>
占位标题
<占位项1>
<占位项2>