Slate FSlateBrush cannot have an exposed pointer to this type

Hi,

It’s probably something very simple. I am trying to give my items a UPROPERTY() FSlateBrush *InventoryBrush, so I can change what icon my items have in the inventory in the defaults of the blueprint.

But the Compiler gives me this error: “Inappropriate ‘*’ on variable of type ‘FSlateBrush’, cannot have an exposed pointer to this type.”

But in order to draw this brush with slate, it needs to be a pointer. What am I missing? If possible please answer beginner-friendly. Thank you :slight_smile:

#Hard Data

Cant you just store the hard data itself?

UPROPERTY(specifiers here)
FSlateBrush  MyBPBrush;

Now you get two things

  1. stability
  2. You can edit the Slate Brush in the Editor using Defaults Tab.

:slight_smile:

#The & Operator

To use this with Slate, send slate the address of your hard data.

MySlateFunctionThatWantsBrushPtr( &MyBPBrush );

When you see slate functions wanting a FSlateBrush*, you send it the above, using the complimentary & symbol

:slight_smile:

Rama

1 Like

That worked. Thank you very much Rama. You’re awesome! :smiley:

I’ve also been trying to do this for my inventory items Rama, but my module isn’t compiling when I declare a variable of FSlateBrush type.

#include "SlateBrush.h"

UPROPERTY(editAnywhere, BlueprintReadWrite, Category = "Appearance")
    FSlateBrush brush;

The compiler outputs this error

error LNK2019: unresolved external symbol “__declspec(dllimport) public: __cdecl FSlateBrush::FSlateBrush(void)” (_imp??0FSlateBrush@@QEAA@XZ) referenced in function …

what if i need to store fslatebrush without generated files? Like in Slate widgets.