link error: LinkGraphNodesFromMaterial unresolved external symbol

Hi,

I need the function LinkGraphNodesFromMaterial to update a graph in my plugin. However, during build, it reports:

error LNK2019: unresolved external symbol “public: void __cdecl UMaterialGraph::LinkGraphNodesFromMaterial(void)” (?LinkGraphNodesFromMaterial@UMaterialGraph@@QEAAXXZ) referenced in function “void __cdecl LinkToColorImage(class IMaterialEditor *,struct FColorMaterialInput &,class UTexture *,enum EMaterialSamplerType)” (?LinkToColorImage@@YAXPEAVIMaterialEditor@@AEAUFColorMaterialInput@@PEAVUTexture@@W4EMaterialSamplerType@@@Z)

I have set my plugin Type to editor.

I have included “MaterialGraph/MaterialGraph.h”

I have added “UnrealEd” module to dependencies.

But no work, and it seems that all the MaterialGraph function related objs are not linked.

Any ideas? Thanks!

PS: My full list of refed modules is :
PublicDependencyModuleNames.AddRange(new string[] { “Engine”, “Core”, “LevelEditor”, “Slate”, “EditorStyle”, “XmlParser”, “ImageWrapper”, “CoreUObject”, “UnrealEd”, “MaterialEditor”, “DesktopPlatform”});

I noticed that MaterialGraph has a tag “MinimalAPI”, so that the LinkGraphNodesFromMaterial can not be called.

How can I do the same thing without calling this function?

I was just following:
https://github.com/EpicGames/UnrealEngine/blob/master/Engine/Source/Editor/MaterialEditor/Private/Tests/MaterialEditorTests.cpp#L48

I have found an alternative way to achieve the link and update by using MaterialExpression and PostEditChange

hello,Do you solve this problem?

Yes and it is a work around. LinkGraphNodesFromMaterial is by design can not be used.