一句簡單的話就夠了,多一個字也多了。
名字版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>