VA_Snippet

<VA_Snippet>
<Language>C++</Language>
<Title>UE_TriggerSphere</Title>
<Shortcut>trigger</Shortcut>
<Description />
<Code>$Sphere$-&gt;SetCollisionEnabled(ECollisionEnabled::QueryOnly);
$Sphere$-&gt;SetCollisionResponseToChannels(ECR_Ignore);
$Sphere$-&gt;SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_TriggerBox</Title>
<Shortcut>trigger</Shortcut>
<Description />
<Code>$box$-&gt;SetCollisionEnabled(ECollisionEnabled::QueryOnly);
$box$-&gt;SetCollisionResponseToChannels(ECR_Ignore);
$box$-&gt;SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
$box$-&gt;SetBoxExtent(FVector(200.0f, 200.f, 200.0f));</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_CreateDefaultSubojject</Title>
<Shortcut>create</Shortcut>
<Description />
<Code>CreateDefaultSubobject&lt;$class$&gt;(TEXT("$name$"));</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_SpawnActor</Title>
<Shortcut>create</Shortcut>
<Description />
<Code>FActorSpawnParameters SpawnParmeters;
SpawnParmeters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
GetWorld()-&gt;SpawnActor&lt;AActor&gt;($Cls$,EyeLocation, EyeRotation, SpawnParmeters);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_GetAllActors</Title>
<Shortcut>allactors</Shortcut>
<Description />
<Code>TArray&lt;AActor*&gt; FoundActors;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), $Class$::StaticClass(), FoundActors);
</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_GetAuthGameMode</Title>
<Shortcut>gamemode</Shortcut>
<Description>ue snippet by cg
</Description>
<Code>GetWorld()-&gt;GetAuthGameMode();</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_GetGameMode</Title>
<Shortcut>gamemode</Shortcut>
<Description>ue snippet by cg
</Description>
<Code>UGameplayStatics::GetGameMode(GetWorld());</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_OnOverlapEvent</Title>
<Shortcut>overlap</Shortcut>
<Description>ue snippet by cg
</Description>
<Code>UFUNCTION()
void BeginOverlapHandler(class UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult&amp; SweepResult);

UFUNCTION()
void EndOverlapHandler(class UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_PlaySound2D</Title>
<Shortcut>playsound</Shortcut>
<Description />
<Code>UGameplayStatics::PlaySound2D(this, $SoundBase$);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_Quit</Title>
<Shortcut>quit</Shortcut>
<Description />
<Code>UKismetSystemLibrary::QuitGame(this, nullptr, EQuitPreference::Quit);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_SetTimer</Title>
<Shortcut>timer</Shortcut>
<Description>ue snippet by cg
</Description>
<Code>FTimerHandle timerHandle;
GetWorldTimerManager().SetTimer(timerHandle, this, &amp;$classname$::FnCallback, 0.5f, false);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_SimpleMoveTo</Title>
<Shortcut>moveto</Shortcut>
<Description />
<Code>UNavigationSystem::SimpleMoveToActor(GetController(), $targetPoint$);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_TEXT</Title>
<Shortcut>text</Shortcut>
<Description />
<Code>TEXT("$end$")</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_LogClass</Title>
<Shortcut>log</Shortcut>
<Description />
<Code>UE_LOG(LogClass, Log, TEXT("$str$%$type$"),$value$);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_LogClass_blank</Title>
<Shortcut>log</Shortcut>
<Description />
<Code>UE_LOG(LogClass, Log, TEXT("$value$"));</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_LPrintMessage</Title>
<Shortcut>log</Shortcut>
<Description />
<Code>GEngine-&gt;AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("$str$%$type$"), $value$));</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_SetParent</Title>
<Shortcut>setparent</Shortcut>
<Description />
<Code>SetupAttachment(RootComponent);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_SpawnEmitter</Title>
<Shortcut>create</Shortcut>
<Description />
<Code>UGameplayStatics::SpawnEmitterAtLocation(this, PickupFx, GetActorLocation());</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_GetOverlappingComponents</Title>
<Shortcut>overlap</Shortcut>
<Description />
<Code>TArray&lt;UPrimitiveComponent*&gt; OverlappingComps;
OuterSphereComponent-&gt;GetOverlappingComponents(OverlappingComps);</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_Foreach_Pawn</Title>
<Shortcut>foriter</Shortcut>
<Description />
<Code>for (FConstPawnIterator it = GetWorld()-&gt;GetPawnIterator(); it; it++) {
    APawn* Pawn = it-&gt;Get();
}</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_Foreach_PC</Title>
<Shortcut>foriter</Shortcut>
<Description />
<Code>for (FConstPlayerControllerIterator it = GetWorld()-&gt;GetPlayerControllerIterator(); it; it++) {
    APlayerController* PC = it-&gt;Get();
}</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_Foreach_Actor</Title>
<Shortcut>foriter</Shortcut>
<Description />
<Code>for (TActorIterator&lt;AActor&gt; it(GetWorld()); it; ++it) {
	AActor* Actor = *it;
}</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_Foreach_UObj</Title>
<Shortcut>foriter</Shortcut>
<Description />
<Code>for (TObjectIterator&lt;$Class$&gt; it; it;++it) {
	$Class$* MyObj = *it;
}</Code>
</VA_Snippet>

<VA_Snippet>
<Language>C++</Language>
<Title>UE_LineTraceSingleByChannel</Title>
<Shortcut>linetrace</Shortcut>
<Description />
<Code>FHitResult HitResult;
FCollisionQueryParams QueryParams;
QueryParams.bTraceComplex = true;

FVector LookAtPoint = FVector();
bool TryTrace = GetWorld()-&gt;LineTraceSingleByChannel(HitResult, ViewPoint, ViewPoint + ViewRotation.Vector() * 10000.0f, ECC_Visibility, QueryParams);
if (TryTrace) {
    LookAtPoint = HitResult.ImpactPoint;
}</Code>
</VA_Snippet>


<VA_Snippet>
<Language>C++</Language>
<Title>UE_OverlapMultiByObjectType</Title>
<Shortcut>overlap</Shortcut>
<Description>OverlapMultiByObjectType
</Description>
<Code>TArray&lt;FOverlapResult&gt; Overlaps;
TArray&lt;TWeakObjectPtr&lt;AActor&gt;&gt; OverlapedActors;
bool TraceComplex = false;

FCollisionQueryParams QueryParams;
QueryParams.bTraceComplex = TraceComplex;
QueryParams.bReturnPhysicalMaterial = false;
//APawn* MasterPawn = MasterPC-&gt;GetPawn();
//if (MasterPawn) QueryParams.AddIgnoredActor(MasterPawn-&gt;GetUniqueID());
bool TryOverlap = GetWorld()-&gt;OverlapMultiByObjectType(
    Overlaps,
    ViewLocation,
    FQuat::Identity,
    FCollisionObjectQueryParams(ECC_Pawn),
    FCollisionShape::MakeSphere(Radius),
    QueryParams);</Code>
</VA_Snippet>