Download

C++ Object

Greetings. I have to create class type Object (with own variables, functions and logic) able to save and edit in Blueprint. I simply create C++ Class Object and Blueprint can construct it, but can’t save it into variable or create instance of this class.

This is code of my object
.h


#pragma once
#include "Object.h"
#include "TestObject.generated.h"
/**
 * 
 */
UCLASS()
class TESTCODE_API UTestObject : public UObject
{
	GENERATED_BODY()

public:

	float TestValue;

	void SetTestValue(float NewTestValue);

};

.cpp


#include "TestCode.h"
#include "TestObject.h"

void UTestObject::SetTestValue(float NewTestValue)
{
	TestValue = NewTestValue;
}

Nothing special.

Some screenshots from blueprints.
636f7166dd46618a3260d8dbbff775f0523ef1ac.png
2132e6e6b4114f020a3bff8d628075d67c3b5a7e.png

BlueprintType for variables, and Blueprintable for blueprint instances
like this:

UCLASS(Blueprintable, BlueprintType)

Thanks, this works!