Can I inherit Slate widgets?

I’m trying to create a Slate animated image class by inheriting SImage and making it display only part of a spritesheet.

So, this is what the class look like:

class SLATECORE_API SAnimation
	: public SImage
{

public:

	SLATE_BEGIN_ARGS(SAnimation)
		: _NumFrames(1)
		, _FrameRate(24)
		, _FrameHeight(128.f)
		, _FrameWidth(128.f)
		, _ImgSize(256.f)
	{}

		SLATE_ARGUMENT(const FSlateBrush*, PieceImage)

		SLATE_ARGUMENT(int32, NumFrames)

		SLATE_ARGUMENT(int32, FrameRate)

		SLATE_ARGUMENT(float, FrameHeight)

		SLATE_ARGUMENT(float, FrameWidth)

		SLATE_ARGUMENT(float, ImgSize)
	
	SLATE_END_ARGS()

	/** Constructor */
	SAnimation()
	{
		SetCanTick(true);
		bCanSupportFocus = false;
	}

	void Construct(const FArguments& InArgs);

And Construct looks like this:

void SAnimation::Construct(const FArguments& InArgs)
{
	Super::Construct(InArgs);

	NumFrames = InArgs._NumFrames;
	FrameRate = InArgs._FrameRate;
	ImgSize = InArgs._ImgSize;
	FrameHeight = InArgs._FrameHeight;
	FrameWidth = InArgs._FrameWidth;
}

I’m getting this error though: "error C4273: ‘SAnimation::Construct’: inconsistent dll linkage"

So, can I even inheart another Slate widget like this? Do I need to declare all the Arguments again?

Thanks

1 Like

You SLATECORE_API before your class name, it should be whatever_your_project_API.

Yes, that solved it. I had copied it from another file and forgot to change that. thanks