Hey guys, posting here as I found lots of answers to this basic question but none of them worked for me in 4.9.
I have an AActor and I simply want to set it a mesh and a material and see them in editor. Here is my code. If you see something wrong.
I always reach the logs in InitComponents() so it seems that my mesh and materials are set properly but nothing shows up.
Also sometimes I manage to see something working when I change my code a little bit and hot reload. But as soon as I change properties, everything is gone. :’(
void ATileGrid::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
InitComponents();
}
Hum… i mean I have the usual mesh slot as available for any staticmeshcomponent so I drag my mesh from the minibrowser you have when clicking on it.
This happens after dragging my Actor in the scene. I have then access to its properties then i can set my mesh
Fondamentaly whats the difference from grabbing the pointer from the ObjectInitializer than from the editor? My pointer is valid and properly assigned to the mesh component so there might be some extra initialization steps, i dont know
ObjectInitializer set objects in defaults when formally those object does not exist in memory. If you don’t have default mesh and material, i don’t see point of setting them in constructor. You should override PostEditChangeProperty as you did and set material and mesh there (which you kind of did and i think it should work), i would also would do that in PostInitializeComponents() because constructor is only called on CBO creation and won’t be called again, which means if you place it on level or game will start it would apply values of those variables from level data to components
" (which you kind of did and i think it should work)" This is the reason of my question: Changing the mesh and material in PostEditChangeProperty doesn’t work at all.
As you can see, my GridMesh component has valid mesh and material (set in AtileGrid properties and assigned in C++ in PostEditChangeProperty) but nothing on screen. I tryed a MarkRenderStateDirty but nothing happens.