title: UE4: Set texture to material (C++)
body: <p>I'm new to unreal coding, I want to apply texture to material, but I'm stuck with creating:</p>
  <pre><code>    UMaterialInterface* Material = CreateDefaultSubobject&lt;UMaterial&gt;(TEXT(&quot;MyMaterial&quot;));
      UMaterialInstanceDynamic* DynamicMatierial = UMaterialInstanceDynamic::Create(Material, this);
  </code></pre>
  <p>I've got this error message:</p>
  <p>NewObject with empty name can't be used to create default subobjects (inside of UObject derived class constructor) as it produces inconsistent object names. Use ObjectInitializer.CreateDefaultSuobject&lt;&gt; instead.</p>
  <p>This error comes from second line. Any idea why this error occurs? <strong>Or is there any other easy way to apply texture to material?</strong></p>