Hey I have a problem with InstancedStaticMesh, the mesh instances are rendered with default material and I can’t figure out why
what I did is:
opened a new c++ project just basic code,
I’ve created:
c++ Actor class “Tile”, declared UStaticMesh in it, I’ve created A blueprint from this class and set the static mesh and material, the material is created by me and it has the “Used with Instanced Static Meshes” flag set
c++ Actor class “MyLevel”, declared UInstancedStaticMeshComponent, and a TSubclassOf in it, the “TSubclassOf” member is UPROPERTY that can be edited anywhere and it is set to Tile Blueprint that I’ve created.
In "MyLevel"constructor I create instancedStaticMeshComponent, in BeginPlay() I check if TSubclassOf is set and if I set the InstancedStaticMesh->SetStaticMesh() and just to test I also add instance of that mesh, and now the mesh is rendered but with default material and I have no idea why. Can any one help solving this problem ?
code from MyLevel class
.h File
.cpp file
code from Tile class
.h file
.cpp file
Material
tile blueprint
MyLevel class Settings in Editor
and the result
on left instanced static mesh with Tile_BP blueprint, on right Tile_BP blueprint dragged and dropped in editor
Can any one tell me why this is happening ?