Earlier bug that is closed when you perform GetWidth or GetHeight

As: [Bug] Compiler Linker Error: UMaterialInterface::GetWidth() and Height() - Programming & Scripting - Unreal Engine Forums describes… when in C++ you do a GetWidth/GetHeight on a UMaterialInstanceDynamic you get an unreferenced link error on UMaterialInterface

Above topic is closed but I have the exact same issue and well I’m on the latest build of the UE (4.7.6)

So I’m wondering if there’s a way to bypass it. What reference do I to add to fix this? Or is there another way to get the width/height of UMaterialInstanceDynamic ?

Hi djmulder,

Our process back in beta was different than it is now. This was marked as resolved in beta because it was able to be resolved by editing the source code, which was a suitable solution at the time. Seeing as we are now released, I’ve put a bug into our database for this issue. For your reference, the bug number is UE-16755. In the meantime, if you are able to use the source code version of the engine, you can make a few simple changes to fix this issue. Navigate to the file “MaterialInterface.h” and change the following lines of code from:

int32 GetWidth() const;
int32 GetHeight() const;

to

ENGINE_API int32 GetWidth() const;
ENGINE_API int32 GetHeight() const;

The issue you were experiencing was because these functions weren’t being exported to the ENGINE_API as most functions are, so it was giving you an access violation.

Have a nice day

Cool thanks,

I sadly don’t run on the source version, tho I probably should.

But yeh thanks. I’ll see if I can transfer into the source version.

Still broken in 4.14.3

GetWidth() still seems to be broken on UMaterialInstance. It compiles, but the link step fails with:

SlidingTilePuzzle.cpp.obj : error LNK2019: unresolved external symbol "public: int __cdecl UMaterialInterface::GetWidth(void)const " (?GetWidth@UMaterialInterface@@QEBAHXZ) referenced in function “protected: virtual void __cdecl ASlidingTilePuzzle::BeginPlay(void)” (?BeginPlay@ASlidingTilePuzzle@@MEAAXXZ)

This is running 4.18.3.

GetWidth is still broken, even with the fix suggested above it still fails with unresolved external symbol
Running 4.21.2