I can’t seem to set a texture on Material in HDRP. Any help? This is the last tech thing before my patch in Starfighter General: //This code assigns a new material for an entity.//The problem is that the mat - Pastebin.com
//This code assigns a new material for an entity.
//The problem is that the material does not have the texture assigned properly.
[Skip]
public static void renderTextureOnMaterialItem(Entity e, Texture tex, int index)
{
UnityEngine.Material mat = GameObject.Instantiate(swapMeMaterial); //a public material
var renderMesh = MyentityManager.GetSharedComponentData<RenderMesh>(e);
renderMesh.mesh =GameObject.Instantiate(cubeMesh);//a public cube mesh
//Seems like these ain't working:
mat.SetTexture("_BaseMap", tex);
mat.SetTexture("_MainTex", tex);
mat.SetTexture("_BumpMap", tex);
mat.SetTexture("_MetallicGlossMap", tex);
///-------
renderMesh.material = mat;
MyentityManager.SetSharedComponentData(e, renderMesh);
}