Skip to content

Instantly share code, notes, and snippets.

@namrog84
Created May 19, 2020 09:13
Show Gist options
  • Save namrog84/aa48c81b909acd124dc5311ac7b18f80 to your computer and use it in GitHub Desktop.
Save namrog84/aa48c81b909acd124dc5311ac7b18f80 to your computer and use it in GitHub Desktop.
/*/
//
InputComponent->BindAction("Button", IE_Pressed, this, &Class::Function);
//
InputComponent->BindAxis("InputAxis", this, &Class::Function);
//
AMyClass* MyCastActor = Cast<AMyClass>(MyActor);
//
UCLASS()
class PROJECTNAME_API ClassName : public ParentClass
{
GENERATED_BODY()
public:
ClassName();
protected:
private:
};
//
ObjectName = CreateDefaultSubobject<ObjectClass>(TEXT("ObjectName"));
//
UENUM(BlueprintType)
enum class EName : uint8
{
N_Name1 UMETA(DisplayName="DisplayName")
};
//
UFUNCTION()
//
UFUNCTION(Client, Unreliable)
void FunctionName(FunctionParameters);
//
UFUNCTION(NetMulticast, Reliable, WithValidation)
void FunctionName(FunctionParameters);
//
UFUNCTION(Server, Reliable, WithValidation)
void FunctionName(FunctionParameters);
//
UGameplayStatics::GetAllActorsOfClass(GetWorld(), AClass::StaticClass(), ActorArray);
//
GameModeClass* gm = GetWorld()->GetAuthGameMode<GameModeClass>();
//
void ClassName::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//DON'T FORGET TO #include "Net/UnrealNetwork.h"
DOREPLIFETIME(ClassName, ClassProperty);
}
//
UWorld* World = GetWorld();
if(World)
{
}
//
GetWorld()->LineTraceMultiByChannel(HitsArray, Start, End, ECC_Visibility, TraceParams);
//
GetWorld()->LineTraceMultiByObjectType(HitsArray, Start, End, ObjectQueryParams, TraceParams);
//
GetWorld()->LineTraceMultiByProfile(HitsArray, Start, End, "ProfileName", TraceParams);
//
GetWorld()->LineTraceSingleByChannel(Hit, Start, End, ECC_Visibility, TraceParams);
//
GetWorld()->LineTraceSingleByObjectType(Hit, Start, End, ObjectQueryParams, TraceParams);
//
GetWorld()->LineTraceSingleByProfile(Hit, Start, End, "ProfileName", TraceParams);
//
UE_LOG(LogTemp, Display, TEXT("Your message"));
//
GetWorld()->OverlapMultiByChannel(OverlapsArray, Location, FQuat::Identity, ECC_Visibility, FCollisionShape::MakeSphere(Radius), TraceParams);
//
GetWorld()->OverlapMultiByObjectType(OverlapsArray, Location, FQuat::Identity, ObjectQueryParams, FCollisionShape::MakeSphere(Radius), TraceParams);
//
GetWorld()->OverlapMultiByProfile(OverlapsArray, Location, FQuat::Identity, "ProfileName", FCollisionShape::MakeSphere(Radius), TraceParams);
//
UGameplayStatics::PlayDialogue2D(GetWorld(), DialogWave, DialogContext, VolumeMultiplier, PitchMultiplier, StartTime);
//
UGameplayStatics::PlayDialogueAtLocation(GetWorld(), DialogWave, DialogContext, Location, Rotation, VolumeMultiplier, PitchMultiplier, StartTime, Attenuation);
//
UGameplayStatics::PlayDialogue2D(GetWorld(), DialogWave, DialogContext, VolumeMultiplier, PitchMultiplier, StartTime);
//
UGameplayStatics::PlayDialogueAtLocation(GetWorld(), DialogWave, DialogContext, Location, Rotation, VolumeMultiplier, PitchMultiplier, StartTime, Attenuation);
//
UGameplayStatics::PlaySound2D(GetWorld(), SoundBase, VolumeMultiplier, PitchMultiplier, StartTime, Concurrency, Owner);
//
UGameplayStatics::PlaySoundAtLocation(GetWorld(), SoundBase, Location, Rotation, VolumeMultiplier, PitchMultiplier, StartTime, Attenuation, Concurrency, Owner);
//
GEngine->AddOnScreenDebugMessage(0, 0.f, FColor::Red, FString::Printf(TEXT("TEXT")));
//
UPROPERTY()
//
UMySaveGame* Instance = Cast<UMySaveGame>(UGameplayStatics::CreateSaveGameObject(UMySaveGame::StaticClass()));
//
UMySaveGame* Instance = Cast<UMySaveGame>(UGameplayStatics::LoadGameFromSlot(SaveSlotName, UserIndex));
//
UGameplayStatics::SaveGameToSlot(Instance, SaveSlotName, UserIndex);
//
void ClassName::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//DON'T FORGET TO #include "Net/UnrealNetwork.h"
DOREPLIFETIME(ClassName, ClassProperty);
}
//
AClass* ActorName = GetWorld()->SpawnActor<AClass>(UClass, Location, Rotation);
//
AClass* ActorName = GetWorld()->SpawnActorDeferred<AClass>(UClass, ActorTransform, Owner, Instigator, ESpawnActorCollisionHandlingMethod::AlwaysSpawn);
/* INITIALIZATION */
UGameplayStatics::FinishSpawningActor(ActorName, ActorTransform);
//
UDecalComponent* MyDecal = UGameplayStatics::SpawnDecalAttached(GetWorld(), DecalMaterialInterface, Size, AttachToComponent, AttachPointName, Location, Rotation, EAttachLocation::KeepRelativeOffset, lifeSpan);
//
UDecalComponent* MyDecal = UGameplayStatics::SpawnDecalAtLocation(GetWorld(), DecalMaterialInterface, Size, Location, Rotation, lifeSpan);
//
UAudioComponent* MyDialog = UGameplayStatics::SpawnDialogue2D(GetWorld(), DialogWave, DialogContext, VolumeMultiplier, PitchMultiplier, StartTime, bAutoDestroy);
//
UAudioComponent* MyDialog = UGameplayStatics::SpawnDialogueAttached(GetWorld(), DialogWave, DialogContext, AttachToComponent, AttachPointName, Location, Rotation, EAttachLocation::KeepRelativeOffset, bStopWhenAttachedToDestroyed, VolumeMultiplier, PitchMultiplier, StartTime, Attenuation, bAutoDestroy);
//
UAudioComponent* MyDialog = UGameplayStatics::SpawnDialogueAtLocation(GetWorld(), DialogWave, DialogContext, Location, Rotation, VolumeMultiplier, PitchMultiplier, StartTime, Attenuation, bAutoDestroy);
//
//
UParticleSystemComponent* MyParticles = UGameplayStatics::SpawnEmitterAttached(ParticleSystem, AttachToComponent, AttachPointName, Location, Rotation, Scale, EAttachLocation::KeepRelativeOffset, bAutoDestroy);
//
UParticleSystemComponent* MyParticles = UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ParticleSystem, Location, Rotation, Scale, bAutoDestroy);
//
UParticleSystemComponent* MyParticles = UGameplayStatics::SpawnEmitterAttached(ParticleSystem, AttachToComponent, AttachPointName, Location, Rotation, Scale, EAttachLocation::KeepRelativeOffset, bAutoDestroy);
//
UParticleSystemComponent* MyParticles = UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ParticleSystem, Location, Rotation, Scale, bAutoDestroy);
//
UAudioComponent* MySound = UGameplayStatics::SpawnSound2D(GetWorld(), SoundBase, VolumeMultiplier, PitchMultiplier, StartTime, Concurrency, bPersistentAcrossLevelTransition, bAutoDestroy);
//
UAudioComponent* MySound = UGameplayStatics::SpawnSoundAttached(SoundBase, AttachToComponent, AttachPointName, Location, Rotation, EAttachLocation::KeepRelativeOffset, bStopWhenAttachedToDestroyed, VolumeMultipler, PitchMultiplier, StartTime, Attenuation, Concurrency, bAutoDestroy);
//
UAudioComponent* MySound = UGameplayStatics::SpawnSoundAtLocation(GetWorld(), SoundBase, Location, Rotation, VolumeMultiplier, PitchMultiplier, StartTime, Attenuation, Concurrency, bAutoDestroy);
//
USTRUCT(BlueprintType)
struct FMyStruct
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=MyCategory)
float test;
};
//
USTRUCT(BlueprintType)
struct FMyStruct : public FTableRowBase
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=MyCategory)
float test;
};
//
UGameplayStatics::PlaySound2D(GetWorld(), SoundBase, VolumeMultiplier, PitchMultiplier, StartTime, Concurrency, Owner);
//
UGameplayStatics::PlaySoundAtLocation(GetWorld(), SoundBase, Location, Rotation, VolumeMultiplier, PitchMultiplier, StartTime, Attenuation, Concurrency, Owner);
//
GetWorld()->GetTimerManager().SetTimer(TimerHandle, this, &Class::Function, DelayTime, bLoop);
//
GetWorld()->GetTimerManager().ClearTimer(TimerHandle);
//
TimerHandle.Invalidate();
//
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment