Skip to content

Instantly share code, notes, and snippets.

@hanzochang
Last active March 4, 2017 04:44
Show Gist options
  • Save hanzochang/89008d90f2cff18152b4b074b48c7ad5 to your computer and use it in GitHub Desktop.
Save hanzochang/89008d90f2cff18152b4b074b48c7ad5 to your computer and use it in GitHub Desktop.
[UE4] Struct Template
// 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;
}
#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