UE4 官方Snippet导入
UE4 引擎自带了一部分扩展部件在Engine/Extras/ 目录下,平时最常用的是UnrealVS的Vistual Studio插件,另外还有一个比较实用的就是VisualStudioSnippets。
在 Engine/Extras/VisualStudioSnippets/ 文件夹下边内置了几十种UE4常用的Snippet,包括UFunction, UProperty,UClass,UE_Log等对应的便捷方法,非常的实用。
安装方法在文件夹下的README.md中已经非常详细:
Visual Studio Snippets for Unreal Engine C++ Projects
===========
How to install snippets?
Method One
Paste .snippet files into: C:\Users$user$\Documents\Visual Studio 2019\Code Snippets\Visual C++\My Code Snippets. Then restart VS.
Method Two
Open Visual Studio, navigate to TOOLS -> Code Snippets Manager… -> Import…
How to use snippets?
Method One
Just start typing ue4… snippet list should be loaded in a form of combo box. Then use arrows to select snippet. Hit ENTER or TAB to insert snippet.
Method Two
Type all snippet name and hit TAB. You don’t have to wait for VS to show snippet list.
To navigate between highlighted fields you can use TAB and SHIFT + TAB. After you enter all names, hit ENTER.
使用方法也提到了两种:
- 只需要输入ue4… 然后根据下拉列表来选择对应的内容,比如输入ue4,选择ue4prop,就会有
/**
* Comment
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyProject")
Type Name;
- 需要输入全名的,例如SingleLineTrace,输入后直接确认,会有
FCollisionQueryParams TraceParams(NAME_None, /*TraceComplex*/ true, /*IgnoreActor*/ this);
FCollisionObjectQueryParams CollisionParams(ECC_WorldDynamic);
FHitResult OutHit;
const bool bHit = World->LineTraceSingle(OutHit, StartPos, EndPos, TraceParams, CollisionParams);
if (bHit)
{
// OutHit Contains Hit Data...
}
当然这些只是默认的设置,如果想要符合自己的输入习惯,可以自己编辑对应的Sinppet文件,来设置更为简洁的前缀提示以及选择列表。