Skip to content

Instantly share code, notes, and snippets.

View sephirot47's full-sized avatar

Victor Anton Dominguez sephirot47

View GitHub Profile
@sephirot47
sephirot47 / UE4 Get Actor's components
Last active August 29, 2015 14:23
UE4 Get Actor's components
UComponentType *myComponent;
TArray<UComponentType*> comps;
actor->GetComponents(comps);
if (comps.Num() > 0) myComponent = comps[0];
@sephirot47
sephirot47 / UE4 Bind function to Axis Input
Last active August 29, 2015 14:23
UE4 Bind function to Axis Input
//Input name //Function to handle the input
this->InputComponent->BindAxis("MoveForward", this, &UMyActor::HandleVerticalAxis);
void UMyActor::HandleVerticalAxis(float v)
{
//v is the float value for the input
}
@sephirot47
sephirot47 / UE4 Common crash causes
Last active August 29, 2015 14:23
UE4 Common crash causes
- GameMode, make sure none of them is null
- Null pointer exceptions
- Having instantiated in the level the same PlayerBP than the one in GameMode
(so when the game starts the GameMode puts another one and it gets duplicated )
- Having BAD CODE(code that can cause a crash), even on startup. Ye, if u have bad code it can crash on startup!!! UE4 does some sort of prebuild or something. Beware of putting code on the constructor that must go in the BeginPlay instead, this happened to me <3
@sephirot47
sephirot47 / UE4 World to screen point
Created June 18, 2015 15:32
UE4 World to screen point
//From the actor's viewport (camera)
FVector2D result;
UGameplayStatics::GetPlayerController(actor, 0)->ProjectWorldLocationToScreen(pointInWorld, result);
//result now has the screen point(x,y)
@sephirot47
sephirot47 / UE4 Get Player Controller of an Actor
Created June 18, 2015 15:31
UE4 Get Player Controller of an Actor
UGameplayStatics::GetPlayerController(actor, 0)
@sephirot47
sephirot47 / UE4 Bind Action
Last active August 29, 2015 14:23
UE4 Bind Action
character->InputComponent->BindAction("Jump", IE_Pressed, this, &AMyCharacter::HandleJump);
character->InputComponent->BindAction("Jump", IE_Released, this, &AMyCharacter::HandleJump);
@sephirot47
sephirot47 / UE4 UPROPERTY UFUNCTION
Created June 28, 2015 20:52
UE4 UPROPERTY UFUNCTION
UPROPERTY(EditAnywhere, Category=Pawn)
float speed;
UFUNCTION(BlueprintCallable, Category=Attachment)
void do() { }
@sephirot47
sephirot47 / UE4 Interesting documentation links
Last active August 29, 2015 14:24
UE4 Interesting documentation links
@sephirot47
sephirot47 / WORST CODE OF ALL MY LIFE .class
Last active January 28, 2021 08:57
WORST CODE OF ALL MY LIFE ugliest idi android parking
buttonTwoDatesPayments.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
Calendar c = Calendar.getInstance();
int mYear = c.get(Calendar.YEAR);
int mMonth = c.get(Calendar.MONTH);
int mDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePicker = new DatePickerDialog( MainActivity.act,
new DatePickerDialog.OnDateSetListener()
@sephirot47
sephirot47 / UE4 Little UMG or Set UMG size or Set UMG Position .cpp
Last active January 28, 2021 09:01
UE4 Little UMG or Set UMG size or Set UMG Position
/*
The key to this is to make a normal UMG, but use the Blueprint function SetAnchors, where Minimum and Maximum inputs to this function go from 0.0 -> 1.0 (normalized screen size).
For example, if I want to put an UMG which only occupies the right bottom corner of the screen, I would use:
SetAnchors, where Minimum = (0.5, 0.5) and Maximum = (1.0, 1.0)
*/