@Zothie Weird error, I have really no idea why it would fail there when used inside a function, glad you have found a workaround. Here is the full error message for future reference:
LogShaderCompilers: Warning: 1 Shader compiler errors compiling TestMat for platform PCD3D_SM5:
LogShaderCompilers: Warning: C:/Development/UnrealSource/UnrealEngine/Engine/Shaders/Private/ShadowDepthPixelShader.usf(): Shader TShadowDepthPSPixelShadowDepth_OnePassPointLighttrue, Permutation 0, VF FLocalVertexFactory:
D3DCompile exception
LogShaderCompilers: Warning: Failed to compile Material /Engine/Transient.TestMat for platform PCD3D_SM5, Default Material will be used in game.
Regarding the Megascan materials as far as I understand it, the license allows using it in any game made with unreal engine. But we are not allowed to share the textures, I’ll just ask whether having textures in a public project as *.uasset is okay or not.