# Uncategorized

### 鼠标控制

* 设置 PlayerController 的字段 ShowMouseCursor 为 true

### FComponentVisualizer

使用 FDynamicMeshBuilder::Draw 绘制的Mesh选不中？

1. Draw传递参数HitProxyId
2. 如果材质是透明材质，使用的HitProxy需要AlwaysAllowsTranslucentPrimitives

## Animation Optimization

Animation Optimization As a recommendation, try to not directly access the Anim Instance at all from other classes. Instead, the Anim Instance should pull data from elsewhere. (<https://docs.unrealengine.com/en-us/Engine/Animation/Optimization>)

Consider fast path.

### Console Variables

ViewMode VisualizeBuffer 可以在运行中切换到 Buffer Visualization，再使用 r.BufferVisualizationTarget ... 查看具体buffer

### Blutility - AssetActionUtility和ActorActionUtility

需要在Edit - Editor Preferences - General - Experimental 中启用 Editor Utility Blueprint

然后在创建菜单选择 Blutility，并且选择父类为AssetActionUtility/ActorActionUtility，如果选择 Blueprint Class 创建即使父类选择的是AssetActionUtility/ActorActionUtility也无法生效。

### HotReloading Module

Window -> Developer Tools -> Modules.

### Garbage Collection

Any UObject pointer stored in a UPROPERTY or in a UE4 container class (such as TArray) is considered a "reference" for the purposes of garbage collection

### 编辑器中如何在不加载资源的前提下使用PackageName获取资源的类型？

使用AssetRegistry获取Package中的Assets, 之后读取AssetClass字段即可

```cpp
FName UTestBPLibrary::GetAssetClassNameByPackageName(const FName& InPackageName)
{
    FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
    IAssetRegistry& AssetRegistry = AssetRegistryModule.GetRegistry();
    TArray<FAssetData> AssetDataArray;
    AssetRegistry.GetAssetsByPackageName(InPackageName, AssetDataArray);
    if (AssetDataArray.Num() > 0)
    {
        return AssetDataArray[0].AssetClass;
    }
    return FName();
}
```

### Tab (Window)

FGlobalTabmanager::Get()->RegisterNomadTabSpawner

### Commandlet

Write class derived from UCommandlet

```cpp
UCLASS()
class UXXXCommandlet
    : public UCommandlet
{
    GENERATED_BODY()

public:

    /** Default constructor. */
    UXXXCommandlet();

public:

    //~ UCommandlet interface

    virtual int32 Main(const FString& Params) override;
};
```

Run commandlet from cmd

UE4Engine\Engine\Binaries\Win64\UE4Editor-Cmd.exe %ABS\_PROJECT\_FILE\_PATH% -run=XXX -OtherParams

### Misc

CameraVector not working at mobile

PostProcessInput0 (Scene Color), Scene Depth,Custom Depth, and Custom Stencil with the following Blendable Locations.

MaterialCompiler.h

WorldContextObject

Game Physics

FramePro & LuaProfile

Shadow Indirect Only: useful for grass

NormalFromHeightMap/NormalFromFunction

OpenGL Matrix: column x row

Euler rotate RzAlpha *RxBeta* RzGama

### Reflection

<https://answers.unrealengine.com/questions/139582/get-property-value.html>

```cpp
 void UUPropertiesInformer::ShowBoolProperties(UObject* Object, bool PrintToLogs)
 {
    // My custom printing method
    PrintMessage("SHOWING BOOL PROPERTIES OF " + Object->GetName(), PrintToLogs);
     // Iterating through bool properties
    for (TFieldIterator<UBoolProperty> Property(Object->GetClass()); Property; ++Property)
    {
          // "Converting" bool to string
        FString value = Property->GetPropertyValue_InContainer(Object) ? "true" : "false";
        PrintMessage("bool " + Property->GetNameCPP() + " = " + value, PrintToLogs);
    }
 }
```

### TODO

PostEngineInit

ESceneDepthPriorityGroup

SSCSEditor

SSCSEditorViewport
