Created
July 2, 2023 11:40
-
-
Save pineoc/448834555138ae140775b10611002889 to your computer and use it in GitHub Desktop.
Unreal Engine Game Mode Base console command sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fill out your copyright notice in the Description page of Project Settings. | |
#include "MyGameModeBase.h" | |
void AMyGameModeBase::crashMe() | |
{ | |
// ensureMsg(false, TEXT("Node is invalid")); | |
ensure(false); | |
check(false); | |
} | |
void AMyGameModeBase::DoSomething() | |
{ | |
GLog->Log("doing something"); | |
} | |
void AMyGameModeBase::DoSomethingElse(float param) | |
{ | |
GLog->Log("Param: " + FString::SanitizeFloat(param)); | |
} | |
void AMyGameModeBase::DoubleParamFunction(float param1, int32 param2) | |
{ | |
GLog->Log("Param1: " + FString::SanitizeFloat(param1) + " - Param2: " + FString::FromInt(param2)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fill out your copyright notice in the Description page of Project Settings. | |
#pragma once | |
#include "CoreMinimal.h" | |
#include "GameFramework/GameModeBase.h" | |
#include "MyGameModeBase.generated.h" | |
/** | |
* | |
*/ | |
UCLASS() | |
class CRASHTEST_API AMyGameModeBase : public AGameModeBase | |
{ | |
GENERATED_BODY() | |
public: | |
/*Function with no parameters*/ | |
UFUNCTION(Exec, Category = ExecFunctions) | |
void crashMe(); | |
/*Function with no parameters*/ | |
UFUNCTION(Exec, Category = ExecFunctions) | |
void DoSomething(); | |
/*Function with one parameter*/ | |
UFUNCTION(Exec, Category = ExecFunctions) | |
void DoSomethingElse(float param); | |
/*Function with two parameters*/ | |
UFUNCTION(Exec, Category = ExecFunctions) | |
void DoubleParamFunction(float param1, int32 param2); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment