Question by
HolyLordJesus · Apr 16, 2020 at 11:23 AM ·
materialdecalprojection
HDRP/Decal initialization through code not working.
If im initializing a decal projector with a material with "HDRP/decal" shader while runtime. The decal/material wont show up ingame until the material gets opened in the inspector. Is this a bug or am i doing something totally wrong here?
public GameObject CreateDecalProjector()
{
GameObject decalProjectorGO = new GameObject("DecalProjector", typeof(DecalProjector));
DecalProjector decalProjector = decalProjectorGO.GetComponent<DecalProjector>();
Material decalMaterial = new Material(Shader.Find("HDRP/Decal"));
decalMaterial.enableInstancing = true;
decalProjector.material = decalMaterial;
return decalProjectorGO;
}
Comment
Your answer
