Problem with changing mesh visibility in C++ class

I’m trying to make a C++ Actor class with two (or more) meshes, and I want to show them in order as time passes. This is my code:

Seem pretty straightforward to me, I have two frames and I alternate the visibility between them. But it doesn’t work. The first frame always shows, and the second is always hidden. If I switch the meshes (load the second mesh on frame 1) then that mesh shows normally, and the other doesn’t. For some reason frame2 is never displayed. I’ve posted the result in the video bellow, when the mesh disappears the other mesh should be visible. Any help is appreciated.

That’s odd, I’d try breakpointing on the line the mesh you can’t see is being set visible, then stepping into that function and seeing if anything strange is happening. I think it should eventually reach USceneComponent::MarkRenderStateDirty(). It’s also worth verifying the component’s static mesh was actually set successfully, you can do that in the debugger or by selecting the component in the editor while it’s running (simulate rather than play).

Thanks a lot man :slight_smile:

I figured it out. The problem is that RootComponent was NULL, I hadn’t initialized it. Now that I did everything is working fine.