i am having trouble getting a pure static blueprint function to compile, this is the error i get.
LogCompile: /home/raptor/Documents/Unreal Projects/MyProject/Plugins/MyPlugin/Source/MyPlugin/Public/IMyPlugin.h(374): Error: 'Function' is not allowed before the Class definition
Error: 'Function' is not allowed before the Class definition
this is my header:
#include "Runtime/UMG/Public/UMG.h"
#include "Runtime/UMG/Public/UMGStyle.h"
#include "Runtime/UMG/Public/Slate/SObjectWidget.h"
#include "Runtime/UMG/Public/IUMGModule.h"
#include "Runtime/UMG/Public/Blueprint/UserWidget.h"
#include "AIController.h"
#include "Components/AudioComponent.h"
#include "AudioDecompress.h"
#include "AudioDevice.h"
#include "ActiveSound.h"
#include "Audio.h"
#include "Developer/TargetPlatform/Public/Interfaces/IAudioFormat.h"
#include "VorbisAudioInfo.h"
#include "IMyPlugin.generated.h"
class IMyPlugin : public IModuleInterface {
IMyPlugin& Get() {
return FModuleManager::LoadModuleChecked<IMyPlugin>("MyPlugin");
}
bool IsAvailable() {
return FModuleManager::Get().IsModuleLoaded("MyPlugin");
}
};
USTRUCT(BlueprintType)
struct FMyCustomStruct {
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, Category=Triangle)
FVector Vertex0;
UPROPERTY(EditAnywhere, Category=Triangle)
FVector Vertex1;
UPROPERTY(EditAnywhere, Category=Triangle)
FVector Vertex2;
};
UCLASS(editinlinenew, meta=(BlueprintSpawnableComponent), ClassGroup=Rendering)
class UMyCustomObject: public UObject {
GENERATED_BODY()
public:
TArray<FMyCustomStruct> MyStructs;
std::weak_ptr<UMyCustomObject> __weakref__;
bool __initialized_UMyCustomObject;
constexpr static const char* __class__ = "UMyCustomObject";
virtual std::string get_class_name(){ return std::string("UMyCustomObject");}
bool SetCustomMeshTriangles(const TArray<FMyCustomStruct>& Structs);
};
UFUNCTION(BlueprintPure,meta=(DisplayName="Hello World",CompactNodeTitle="HelloWorld",Keywords="String Hello World"))
static FText HelloWorld();
this is my cpp file:
#pragma once
#include <ModuleManager.h>
//#include <MyPluginPrivatePCH.h>
#include <IMyPlugin.h>
bool UMyCustomObject::SetCustomMeshTriangles(const TArray<FMyCustomStruct>& Structs) {
this->MyStructs = Structs;
return true;
}
FText UCreateNewObject::HelloWorld() {
return FText::FromString("Hello World!");
}
class FMyPlugin : public IMyPlugin {
virtual void StartupModule() override {
std::cout << std::string("TESTING MYBLUEPRINT...") << std::endl;
}
virtual void ShutdownModule() override {
std::cout << std::string("MYBLUEPRINT EXIT") << std::endl;
}
};
IMPLEMENT_MODULE( FMyPlugin, MyPlugin )