Last active
March 4, 2017 04:44
-
-
Save hanzochang/89008d90f2cff18152b4b074b48c7ad5 to your computer and use it in GitHub Desktop.
[UE4] Struct Template
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 "MyProject.h" | |
#include "MyStruct.h" | |
FMyStruct FMyStruct::New(int32 AwesomeInt, float AwesomeFloat) | |
{ | |
FMyStruct MyStruct; | |
MyStruct.AwesomeInt = AwesomeInt; | |
MyStruct.AwesomeFloat = AwesomeFloat; | |
return MyStruct; | |
} | |
FString FMyStruct::ToStringForDebug() | |
{ | |
FString Result; | |
Result = | |
"AwesomeInt: " + FString::FromInt(AwesomeInt) + " | " + | |
"AwesomeFloat: " + FString::SanitizeFloat(AwesomeFloat); | |
return Result; | |
} |
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
#pragma once | |
#include "MyStruct.generated.h" | |
USTRUCT(BlueprintType) | |
struct FMyStruct | |
{ | |
GENERATED_BODY() | |
public: | |
UPROPERTY(EditAnyWhere, BluePrintReadWrite, Category = "Struct") | |
int32 AwesomeInt; | |
UPROPERTY(EditAnyWhere, BluePrintReadWrite, Category = "Struct") | |
float AwesomeFloat; | |
public: | |
static FMyStruct New(int32 AwesomeInt, float AwesomeFloat); | |
public: | |
FString ToStringForDebug(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment